msgraph-sample-javascriptspa icon indicating copy to clipboard operation
msgraph-sample-javascriptspa copied to clipboard

Calling graph API without graphClient

Open SureshNegi opened this issue 6 years ago • 1 comments

I am following the below link to call the Graph API in my angularjs application: https://docs.microsoft.com/en-us/graph/tutorials/javascript In code msalClient is declared as: const msalClient = new Msal.UserAgentApplication(msalConfig); With the help of msalClient we show the login pop up and user gets authenticated.

Now As per the tutorial, if we want to call the graph API , we can use graphClient as below: const graphClient = MicrosoftGraph.Client.initWithMiddleware({ authProvider }); graphClient.api('/me/events')

I do not want to use graphClient. I want to make Http Request in angularjs service. For this I need to pass authrizaton code to API.

How can I get authorization code

SureshNegi avatar Jun 10 '20 06:06 SureshNegi

Thanks for your interest @SureshNegi! This isn't a good place to ask "how to" questions, you'll get much more visibility on your questions on Stack Overflow. You might want to take a look at this bit of code from our Angular tutorial:

https://github.com/microsoftgraph/msgraph-training-angularspa/blob/d48d876f730920e9f7b5562a37d4f45b3007c0fd/demo/graph-tutorial/src/app/auth.service.ts#L52-L62

jasonjoh avatar Jun 10 '20 14:06 jasonjoh