0

I'm using Microsoft graph API call to get details of organization .I need requirement to pass only tenant Id dynamically from front end in place of https://login.microsoftonline.com/tenantId/oauth2/v2.0/token for rest API in Microsoft graph .Can anyone help me out to solve this issue.. Thank you.

careerquo
  • 11
  • 2

1 Answers1

0

You can retrieve Tenant ID for user using Microsoft Graph like it is described in this answer on another question https://stackoverflow.com/a/63014761/481

then you can replace it in your URL for token request. I did something similar in this Arduino example https://github.com/panjkov/esp32-msgraph-presence/blob/main/src/MSGraphPresence/MSGraphPresence.ino

Dragan Panjkov
  • 4,302
  • 4
  • 28
  • 26
  • Thank you for sharing I got the API to get tenant id. I'm using react js But the issue was to know how to call Microsoft graph API with using only tenant id in request Param in place of passing https://login.microsoftonline.com/tenantId/oauth2/v2.0/token without using token endpoint . Please share the links for reference to solve the issue.. Thank You – careerquo Jun 04 '21 at 06:45
  • thank you referred and got the solution .. can I know How to return an error message using Microsoft graph api using axios methods – careerquo Jun 04 '21 at 09:06
  • I am not familiar with Axios. As that is different question, I suggest that you post it as separate question for better visibility, and don't forget to add tag for Axios. – Dragan Panjkov Jun 04 '21 at 17:26