12

Microsoft graph throws the below exception when initializing the client using the access token

enter image description here

the access token was generated just before initializing the client & also the same token works in post-man

what is that I'm doing wrong?

code

let graphClient = graph.Client.init({
        // Use the provided access token to authenticate
        // requests
        authProvider: (done) => {
            done(null, accessToken);
        }
    });

Post-man response

enter image description here

General Grievance
  • 4,555
  • 31
  • 31
  • 45
ChinnarajS
  • 644
  • 5
  • 20

1 Answers1

23

Quoting the install guide:

import @microsoft/microsoft-graph-client into your module and also you will need polyfills for fetch like isomorphic-fetch.

Here is what you need to do.

npm install isomorphic-fetch
import "isomorphic-fetch"; OR require('isomorphic-fetch');
Danstan
  • 1,501
  • 1
  • 13
  • 20