I was working on a JS app which talks to Azure AD app using OIDC. Here is the flow of authentication and validation -
- Redirect user to common login end point
- Get access token, id_token etc. on callback url
- Validate response with jwt keys retrieved from discovered url -
https://login.microsoftonline.com/common/discovery/keys
- Get user info from discovered
userinfo
url -https://login.microsoftonline.com/common/openid/userinfo
- Store the information in local / session storage, depending upon settings.
The problem with Azure AD is, we can not complete step 3 and 4. Both the urls do not support CORS. We are not able to validate the tokens we get and can't retrieve the user information.
Is there any better way to get userinfo in Microsoft's implementation of OpenID for Azure AD?