5

I am a newbie in sharepoint. I was trying to get the access token via oauth and came to know that tenant Id or site realm of sharepoint account. Where do I find it or how can I retrieve it ?

Sachin
  • 1,675
  • 2
  • 19
  • 42

2 Answers2

10

From UI:

  • navigate to Site Collection App Permissions page (http:// <SharePointWebsite> /_layouts/15/AppPrincipals.aspx)

  • identify the row with your registered application and locate at the App Identifier column. Site realm corresponds to the part of App Identifier followed after the last @ delimiter

enter image description here

Vadim Gremyachev
  • 57,952
  • 20
  • 129
  • 193
6

Use this web service :

https://login.microsoftonline.com/{yourTenantName}/.well-known/openid-configuration

replace {yourTenantName} by your tenant name. It is something like "myTenant.onmicrosoft.com" or "mycompany.com"

The web service will return json. If you are using chrome, chrome will diplay the json if you are using IE, IE will send you the json as a file.

Within the json you will find the tenant id at the begining after the segment login.microsoftonline.com:

{"authorization_endpoint":"https://login.microsoftonline.com/9eb7386c-e1gb-4fa6-bbad-1de55c0c90ce/oauth2/authorize",....

here is the Microsoft documentation:

https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-openid-connect-code

Marc Charmois
  • 99
  • 1
  • 3