Search code examples
azureoauthmicrosoft-graph-apicredentials

Unable to get response from Microsoft Graph API endpoint


I set up a new Application in microsoft azure and got the admin to consent application permissions for this app ( files.ReadWriteAll). I am able to get the access_token through POSTMAN. I am trying to get drive information using this endpoint

https://graph.microsoft.com/v1.0/drives/{drive-id}

But I get an error response :-

{ "error": { "code": "AccessDenied", "message": "Either scp or roles claim need to be present in the token.", "innerError": { "request-id": "905c7701-8b89-4711-9204-b00c4a09a921", "date": "2019-03-28T15:56:29" } } }

I used this link to get info on my access token. http://jwt.calebb.net/

Files.Readwrite permissions don't seem to be listed anywhere in the info ( not sure why) . The azure site shows that consent was granted.

Azure permissions set up for my app: Azure permissions set up for my app


Solution

  • Check the steps as below.

    1. Register your app following this document, and Grant permissions.

    2. get access token like this.

    enter image description here

    1. Check the token

    enter image description here

    1. Call graph api enter image description here