Permissions for application

Nach Mikhail 21 Reputation points
2022-03-29T08:12:20.71+00:00

Hello.
I'm trying to get the user's license information using the method List licenseDetails.
In permissions for application sad "Permissions (from least to most privileged)". My application have next permission's:
-User.Read.All

  • Directory.Read.All

Why do I get a 401 error when I try to get user license information? I'm trying to get, not modify using a GET request:
GET /users/{id}/licenseDetails

Thank you.

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

Accepted answer
  1. CarlZhao-MSFT 40,311 Reputation points
    2022-03-29T09:42:09.223+00:00

    Hi @Nach Mikhail

    Make sure your application has been granted the User.Read.All or Directory.Read.All application permission and used the token obtained by the client credential flow.

    187868-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Nach Mikhail 21 Reputation points
    2022-03-29T11:37:55.64+00:00

    Hello.
    The application had permissions.
    I incorrectly formed a request for a token. Formed it as a request to API MDE. I redid the request and received the token. Thanks for answers!

    0 comments No comments