OneDrive API connection is not working for my outlook365 account

Luis 20 Reputation points
2023-01-31T02:58:12.3833333+00:00

In my proyect, my users can sync their onedrive so they canuse their files within my application. I wrote the code and when i try and connect my personal hotmail account it works fine. I get access to the files in my drive no problem. BUT the problem is that whenever I try to connect my onmicrosoft.com mail account i get the following error:

error=invalid_client&error_description=AADSTS650053%3a+The+application+%27MyApp%27+asked+for+scope+%27Files.Read%2cFiles.Read.All%2cFiles.ReadWrite%2coffline_access%2cFiles.ReadWrite.All%2cFiles.ReadWrite.AppFolder%2cFiles.ReadWrite.Selected%2cUser.Read%27+that+doesn%27t+exist+on+the+resource+%2700000003-0000-0000-c000-000000000000%27.+Contact+the+app+vendor.%0d%0aTrace+ID%3a+3cf8783e-acf7-4f47-916f-93c8ca7fe501%0d%0aCorrelation+ID%3a+6d0f7eff-4eed-4bc6-bd5c-1765c67961f3%0d%0aTimestamp%3a+2023-01-31+02%3a52%3a39Z

I double checked my azure portal and the scopes are on the app. AND this only happens when I try to use my onmicrosoft.com account. My personal one works like a charm. And the code is the same for both cases, it is the same app, same request, same everything.

I think it may be a problem with the onmicrosoft account, but i found no documentation on the matter.

Any ideas?

Outlook Windows Classic Outlook for Windows For business
Microsoft 365 and Office SharePoint Development
Microsoft 365 and Office OneDrive For business Windows
Microsoft Security Microsoft Graph
{count} votes

Accepted answer
  1. CarlZhao-MSFT 46,371 Reputation points
    2023-01-31T07:26:50.9233333+00:00

    Hi @Luis

    I decoded your error message and found that you are using "," sign to separate permissions, which may be the cause of the problem. You should separate permissions with spaces, like this:

    scope=Files.Read Files.Read.All Files.ReadWrite offline_access Files.ReadWrite.All Files.ReadWrite.AppFolder Files.ReadWrite.Selected User.Read


    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.