question

AbhayChandramouli-2076 avatar image
0 Votes"
AbhayChandramouli-2076 asked ZehuiYaoMSFT-7151 edited

Microsoft Graph API : Do we need to be logged in to make an Graph API call ?

Hi,
I am trying to make a Microsoft Graph api call using a SPA React JS application. Do I need to be logged in to make an api call like say /users/{id} ? I used the msal sdk and it feels it requires an accesstoken to make api calls.

I am trying to achieve a scenario where I try to login and check if the username exists, if it does I capture the password and update it. Else I create a new user. This is similar to Seamless Account Migration setup.

  1. I want the user to click on login

  2. He enters his username and password. ( This is him logging in first time after migration)

  3. If his migration status is false, I capture the password and save it, and set mig status as true.

  4. then he gets logged in

So for this, I need to make an MS Graph API Call before the user is logged in. So for that I am facing issues.

Please help



azure-ad-b2cmicrosoft-graph-users
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ZehuiYaoMSFT-7151 avatar image
0 Votes"
ZehuiYaoMSFT-7151 answered ZehuiYaoMSFT-7151 edited

Hello@AbhayChandramouli-2076, before you call the Microsoft Graph API , you need acquire an access token from the Microsoft identity platform as stated in the documentation.
You can Install the Microsoft Graph SDK to authorization and API calls in Javascript.



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.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.