AccessDenied - Either scp or roles claim need to be present in the token.

Ronaldo Resende (OMG) 0 Reputation points
2023-06-13T13:57:52.6666667+00:00

The Cloud engineer in our organization created an app with these delegated permissions for me: Sites.Read.All, Sites.Manage.All & Files.ReadWrite.All

I've been trying to work in Postman with the client_id, tenant_id and secret given to me, but I need help getting a proper auth token. What am I doing wrong?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,306 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ab-8756 800 Reputation points
    2023-06-13T20:10:56.04+00:00

    Hello Ronaldo Resende (OMG),
    Thank you for your post in this Q&A forum.

    It seems like the token as you generated is a application token but you have only assigned delegated permissions. Please check your token, you can copy your token and past it to JWT.MS. for application token the permissions will show under roles and for delegated token, permissions will show under scp.
    Something like, scp;- AccessReview.Read.All, AuditLog.Read.All....
    If the token shows roles, you need to generate delegate access token then authenticate.

    auth.png

    Hope that helps.

    Thanks
    --please don't forget to upvote and Accept as answer if the reply is helpful--


  2. CarlZhao-MSFT 42,606 Reputation points
    2023-06-14T02:34:49.37+00:00

    Hi @Ronaldo Resende (OMG)

    Delegated permissions do not support the daemon-based client credential credential flow, so it does not map into the access token.

    Delegated permissions are only available in a delegated authentication flow, so you should use a delegated authentication flow to obtain an access token, such as the auth code flow or ROPC flow.

    Parse the access token and you'll be able to see the delegated permissions you granted in the scp claim:

    3

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.