I had googled a lot on this issue yet nothing helped me. I had seen many similar post also but no useful.
I am using MS Graph API V2 to access user emails,calendar and contacts data.
Authorize URL:
Token Request URL:
https://login.microsoftonline.com/common/oauth2/v2.0/token
Headers:
Content-Type:application/x-www-url-form-urlencoded
Body:
client_id:ABC
redirect_uri:RedirectURL
grant_type:authorization_code
client_secret:KEY
code: pasted from browser URL
I am successfully getting code in browser URL after signing in and using same code to get access token also.
User Profile/Mail Messages/Contacts Request:
Ex: I am trying to read user profile as well user mail messages.
Respective Requests:
Profile: https://graph.microsoft.com/v1.0/me/
Mail Messages: https://graph.microsoft.com/v1.0/me/messages
Header: Authorization:Bearer (AccessToken pasted from token request)
But I am getting below error whichever request in above using.
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure.",
"innerError": {
"request-id": "1e232525-6772-483e-87e3-679d5fcb8fb5",
"date": "2019-02-22T11:53:50"
}
}
}
I had set permissions for mail read and write , access calendars data, contacts ( Full access)
I created application in https://apps.dev.microsoft.com