首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >代表flow返回AADSTS50013断言签名验证失败。原因-钥匙找不到

代表flow返回AADSTS50013断言签名验证失败。原因-钥匙找不到
EN

Stack Overflow用户
提问于 2020-10-22 02:44:15
回答 1查看 4K关注 0票数 1

我有一个Web API,需要代表用户调用Microsoft。我正在使用这里描述的OBO流。

为了获得访问令牌,我将发帖到

代码语言:javascript
运行
复制
POST - https://login.microsoftonline.com/<my-tenant-id>/oauth2/v2.0/token

grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
&client_id=<my-client-id>
&client_secret=<my-client-secret>
&assertion=<user's access token>
&scope=https://graph.microsoft.com/files.readwrite.all
&requested_token_use=on_behalf_of

调用失败的消息如下:

代码语言:javascript
运行
复制
{
    "error": "invalid_grant",
    "error_description": "AADSTS50013: Assertion failed signature validation. [Reason - The key was not found.]\r\nTrace ID: fb813f8e-ce15-4d09-bbae-9db5e5195a00\r\nCorrelation ID: ecb4e087-5506-4224-8f11-72fbf574beac\r\nTimestamp: 2020-10-22 02:18:57Z",
    "error_codes": [
        50013
    ],
    "timestamp": "2020-10-22 02:18:57Z",
    "trace_id": "fb813f8e-ce15-4d09-bbae-9db5e5195a00",
    "correlation_id": "ecb4e087-5506-4224-8f11-72fbf574beac",
    "error_uri": "https://login.microsoftonline.com/error?code=50013"
}

知道我可能做错了什么吗?

对周昌西的回应,

我有一个有角度的应用程序:

@azure/msal-角形“:"^1.0.0","msal":"1.3.3”

在app.module中,MSAL配置如下:

代码语言:javascript
运行
复制
    MsalModule.forRoot(  
    {  
    auth: {  
      clientId: environment.msClientId,      // app1-client-id  
      authority: environment.msAuthorithy,   // https://login.microsoftonline.com/<tenant-id>  
      redirectUri: environment.msRedirectUri // https://localhost:4200/callback  
    },  
    cache: {  
      cacheLocation: 'localStorage',  
      storeAuthStateInCookie: false  
    },  
  },  
  {  
    consentScopes: ['user.read', 'openid'],  
    protectedResourceMap: [  
      ['https://app-2', ['api://app-2-id/scope-name']],  
    ]  
  }  
)  

在测试组件中:

代码语言:javascript
运行
复制
import { Component, OnInit } from '@angular/core';
import { MsalService } from '@azure/msal-angular';

@Component({
  selector: 'app-test',
  templateUrl: './test.component.html',
  styleUrls: ['./test.component.scss']
})
export class TestComponent implements OnInit {
  constructor(private msal: MsalService) {}

  ngOnInit(): void {
    this.msal.acquireTokenSilent({ scopes: ['api://app-2/scope-name'] }).then(response => {
      console.log(response);
    });
  }
}

从控制台获取访问令牌,并在postman中为OBO写一篇文章。

EN

回答 1

Stack Overflow用户

发布于 2020-10-22 04:02:53

错误是&assertion

您需要创建两个应用程序,一个是客户端应用程序(Test_1),另一个是web应用程序(Test_2)。

在test_2应用程序中,您需要公开一个api。

在test_1应用程序中,您需要授予test_1访问test_2的权限。

测试会议。首先,使用ROPC授权流为test_ 2应用程序请求访问令牌。

ropc赠款流动

注意,这里的作用域是api://{test_2 application id}/.default

其次,使用OBO流为microsoft图形api端点请求访问令牌。

代表flow

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64474484

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档