Microsoft Graph API - Could not obtain a WAC access token

25 views Asked by At

I want to create integration with Microsoft excels.

But every time I send a request to the Microsoft Graph API to create or read excel, I get the following error:

code: "AccessDenied" message: "Could not obtain a WAC access token."

Here is my scopes (all of those are delegated):

[
 "Files.Read",
  "Files.Read.All",
  "Files.ReadWrite",
  "Files.ReadWrite.All",
  "User.Read",
  "offline_access",
]

And here is the basic logic.

The first thing I get id from this route const response = await graphClient.api("/me/drive/root").get();

Then, when I make a request with that id, I get an error that I described above.

const response = await graphClient
            .api(`/me/drive/items/${id}/workbook/tables/add`)
            .post({ fileFormat: "workbook" });

I have tried to create a session first, re-authenticate the user, but it also doesn't work.

0

There are 0 answers