首页 文章

使用Adal Angular在Microsoft Graph API中访问令牌验证失败

提问于
浏览
2

我在门户网站中注册了角度应用程序,并使用adal-angular4(https://www.npmjs.com/package/adal-angular4)库来检索访问令牌 . 尝试使用标头中的访问令牌调用Microsoft图形API https://graph.microsoft.com/v1.0/me时,接收错误为'Access token validation failure' .

{
"error": {
    "code": "InvalidAuthenticationToken",
    "message": "Access token validation failure.",
    "innerError": {
        "request-id": "722c9af9-f13b-4d0a-adbe-83ec349e0d16",
        "date": "2017-08-28T04:40:12"
    }
}
}

1 回答

  • 0

    您获得的令牌可能只是您的应用程序的令牌 .

    Graph API的所有令牌都应具有 https://graph.microsoft.com 的受众群体 . 要检查这一点,您可以复制令牌并将其粘贴到https://jwt.ms(Microsoft创建的页面以检查JWT令牌) .

    这个answer可能会引导你朝着正确的方向前进 . 另外请务必请求Microsoft Graph api Scope .

相关问题