access token generation

Santiago Perez Paroni 0 Reputation points
2024-01-18T23:45:13.28+00:00

I am automating the generation of the access token to get images from my oneDrive automatically without having to copy and paste the token provided on the page. Reviewing the documentation and others I got to generate the token and at the time of wanting to use it in the API to get images of a folder in my OneDrive returns me the error '401 Unauthorized'. I was investigating but I can not solve this error I went to azure granted permissions and nothing. I don't know if it is the scope I am using

Microsoft Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,371 Reputation points
    2024-01-22T09:36:38.46+00:00

    Hi @Santiago Perez Paroni

    If you are using the graph API to get drive items in OneDrive, follow this process:

    • Grant your app the Files.ReadWrite.All application permission and grant admin consent. User's image
    • Request an access token using the daemon-based client credentials flow, as you are doing now.
    • Call the GET /drives/{drive-id}/items/{item-id} API to get your image.

    User's image

    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.