Sitemap

Making Azure AD OIDC Compliant

8 min readAug 21, 2019

--

Press enter or click to view image in full size
So you thought using Azure Active Directory for OpenID Connect authentication would be easy? Think again.

Note: Microsoft is continuously improving their implementation of v2.0 with new features so the information here is valid as of May 2020. Please check the extensive documentation for latest information.

Press enter or click to view image in full size
Enable Implicit Flow in App Registration

MsGraph recognized an opportunity to improve security for users. They achieved this by putting a ‘nonce’ into the jwt header. The JWS is signed with a SHA2 of the nonce, the ‘nonce’ is replaced before the JWS is serialized. To Validate this token, the ‘nonce’ will need to be replace with the SHA2 of the ‘nonce’ in the header. Now this can change since there is no public contract.

Press enter or click to view image in full size
Default Azure AD OIDC implementation only works with Graph APIs
Press enter or click to view image in full size
Add Custom Scope to change the audience of token to your own application

The Issuer Identifier for the OpenID Provider (which is typically obtained during Discovery) MUST exactly match the value of the iss (issuer) Claim.

Press enter or click to view image in full size
Use v2.0 if you are setting up a new OIDC authentication as it is “OIDC certified”

v1.0 and v2.0 tokens can be issued by both the v1.0 and v2.0 endpoints! id_tokens match the endpoint they’re requested from, and access tokens match the format expected by the Web API your client will call using that token. So if your app uses the v2.0 endpoint to get a token to call Microsoft Graph, which expects v1.0 format access tokens, your app will receive a token in the v1.0 format.

It could be an email address, phone number, or a generic username without a specified format. Its value is mutable and might change over time. Since it is mutable, this value must not be used to make authorization decisions.

New way of selecting Optional Claims

--

--