We have a multi-tenant app which has been passing in "login.windows.net/common" when creating a new AuthenticationContext. We missed the memo a while back that this had been deprecated in favor of "login.microsoftonline.com/common". The impetus for switching now is that we have customers for whom that also won't work (e.g. because they're behind "login.microsoftonline.de").
We understand the correct approach is to first query "login.microsoftonline.com/tenant-domain-name/.well-known/openid-configuration", and use the endpoints we get back, instead of hardcoding login.microsoftonline.com. What we're wondering is which of the fields we get back should be used.
I haven’t been able to find an authoritative (no pun intended) source for what the authority string should be. Some places I’ve checked:
- The documentation for AuthenticationContext says authority is, “Address of the authority to issue token.”
- The developer’s guide for integrating AAD with Windows Store apps references creating AuthenticationContext with an authority, doesn’t say what authority should be.
- The sample code for a Windows Store app uses "login.microsoftonline.com/tenant".
- The AAD docs say for multi-tenant apps, use "login.microsoftonline.com/common".
- Other answers here on StackOverflow have ranged covered those, specific paths (like "/oauth2/token"), etc.
So, after we query the discovery service, what do we then use for authority?
- authorization_endpoint?
- token_endpoint?
- map tenant_region_scope to the right login.microsoftonline.com variation, and append "/common"? or "/tenant"?
Thank you.