Microsoft Graph SDK

S R 81 Reputation points
2021-11-11T06:43:17.107+00:00

Hii , I have been converting my code to ms graph sdk.I have been facing these issues:

  1. For auth provider instance, I have been using the TokenCredentialAuthenticationProvider as per documentation. Here is the
    sample that I have written : const credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
    const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: [scopes] });
    const client = Client.initWithMiddleware({ debugLogging: true, authProvider }); While accessing the workbook and chart's api I have been getting this error
    /me request is only valid with delegated authentication flow. For the workaround, I researched and used the custom authProvider instance : const client = Client.init({ defaultVersion: "v1.0", authProvider: (done) => { done(error, accessToken); } }); and it worked like a charm. Why couldn't I access using the above TokenCredentialAuthenticationProvider ?
  2. I have been getting the error that I can't push data more than of 4mb inside a workbook in a single api hit .What's the
    workaround for this except for diving data using parallel api hits.
  3. Can I add images using URL / base64 encoded inside the workbook since there's no documentation regarding that.
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,992 questions
{count} votes

Accepted answer
  1. CarlZhao-MSFT 45,021 Reputation points
    2021-11-12T07:48:28.907+00:00

    Why couldn't I access using the above TokenCredentialAuthenticationProvider?

    This is because you are using the wrong authorization flow to obtain the token. The client credential flow can only be used to call the /users/{user id} endpoint because the flow is based on a daemon without user participation.

    Because you are calling the /me endpoint that requires user interaction, the client credential flow is clearly not for you. You can use Authorization code provider to solve this problem.


    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 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.