NoPermissionsInAccessToken while trying to read mail from mailbox

Faraha 46 Reputation points

I am using this

url:{my client id}/oauth2/v2.0/token

"grant_type": "client_credentials",
"client_id" : "e87u998-8878-jju89-****",
"scope" : "",
"client_secret" : "***********"

and I fetched the access token successfully
After that I tried to read messages using
Authorization: Bearer 69909acesstoken-897899

and I and got this error message
"error": {
"code": "NoPermissionsInAccessToken",
"message": "The token contains no permissions, or permissions can not be understood.",
"innerError": {
"requestId": "ee4bb405-*-4b18-abcf-********",
"date": "2020-06-16T18:15:57",
"request-id": "ee4bb405-*

My app has delegated access for User.Read and Mail.Read

Please suggest

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,488 questions
0 comments No comments
{count} votes

Accepted answer
  1. Saurabh Sharma 23,791 Reputation points Microsoft Employee

    @Faraha You need to provide Mail.Read Application permissions and then Grant Admin consents by using the Azure AD v2.0 “/adminconsent” endpoint.

    You need to build a Admin consent URL as shown below:{tenant-id}/adminconsent?client_id={client-id}&state={random-string}&redirect_uri={redirect-url}.

    Please refer to the documentation for more information.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Faraha 46 Reputation points

    Thanks.I will try with that.

    0 comments No comments

  2. Faraha 46 Reputation points

    It worked.Thanks a lot :)