【发布时间】:2018-02-05 07:33:31
【问题描述】:
我已经在门户中注册了 Angular 应用程序并使用 adal-angular4 (https://www.npmjs.com/package/adal-angular4) 库来检索访问令牌。尝试使用标头中的访问令牌调用 Microsoft 图形 API https://graph.microsoft.com/v1.0/me 时,收到错误为“访问令牌验证失败”。
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure.",
"innerError": {
"request-id": "722c9af9-f13b-4d0a-adbe-83ec349e0d16",
"date": "2017-08-28T04:40:12"
}
}
}
【问题讨论】:
-
您可以尝试从this site 解码访问令牌,令牌中的
aud声明是什么? -
它将 aud 声明显示为我的客户端 ID (Guid),而不是 'graph.microsoft.com'
-
令牌不正确,您应该获取 Microsoft Graph 的令牌。参考this link。
标签: angular microsoft-graph-api azure-authentication