3

I have registered the angular application in the portal and using adal-angular4 (https://www.npmjs.com/package/adal-angular4) library to retrieve the access token. While trying to call the Microsoft graph API https://graph.microsoft.com/v1.0/me with the access token in the header, receiving the error as '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"
    }
}
}
Navya Canumalla
  • 507
  • 2
  • 7
Harish
  • 193
  • 1
  • 3
  • 14
  • You can try to decode the access token from [this site](https://jwt.io/) and what's `aud` claim in the token? – Fei Xue Aug 28 '17 at 07:58
  • It shows the aud claim as my client id (Guid) and not 'https://graph.microsoft.com' – Harish Aug 30 '17 at 04:25
  • The token is incorrect, you should acquire the token for Microsoft Graph. Refer [this link](https://developer.microsoft.com/en-us/graph/docs/concepts/auth_overview). – Fei Xue Oct 29 '17 at 08:56

1 Answers1

1

The token you got is probably just a token for your application.

All tokens for the Graph API should have an Audience of https://graph.microsoft.com. To check this you can copy the token and paste it on https://jwt.ms (a Microsoft created page to check JWT tokens).

This answer might steer you in the right direction. Also be sure to request a Microsoft Graph api Scope.

Stephan
  • 2,356
  • 16
  • 38