OpenID Connect describes a metadata document that contains most of the information required for an app to do sign-in. This includes information such as the authorization endpoint, token endpoint, tenant region scope, etc. For the discovery endpoint, this is the OpenID Connect metadata document you should use:
https://login.windows.net/{domain}/.well-known/openid-configuration
The {domain} can take one of two values:
Value | Description |
common | Users with both a personal Microsoft account and a work or school account from Azure AD can sign in to the application. |
contoso.com | The friendly domain name of the Office 365 tenant |
The metadata is a simple JSON. See the following snippet for an example.
To get the tenant ID, we just need to parse the token_endpoint property as shown below:
We will get the following JSON for the invalid domain name.
Hope this helps. Sharing is Caring !
The post Get Office 365 Tenant ID from Domain Name appeared first on SharePoint Rider.