Usage with Azure AD
Hello,
Currently I'm on a project with an existing Azure AD infrastructure. I need to make a Single Page Application which should authenticate with Azure AD and use access tokens to call API's. I have some experience with this oidc-client-js library connecting to a IdentityServer 4 so it is tempting to use it also with Azure AD.
My question is the following:
- Would the oidc-client-js library work well with Azure AD?
- How does oidc-client-js compare to adal.js, the (Microsoft) recommended javascript lib for Azure AD?
Thanks in advance,
Ronald Wijnsema
AAD doesn't 100% support the intent of the OIDC spec, so this library might not work 100% easily with it. I have heard of others using it and making it work, though.
Thanks Brock, I'll go for adal.js then for a start, maybe things get more standardized in the future.
To anyone who was able to make it work already, please share!
Ronald Wijnsema
Could you write what exactly is not supported by AAD?
IIRC they don't support CORS on the metadata and userinfo endpoints. also they don't allow certain flows, but i don't recall which combo they don't allow. IIRC i think for implicit they don't allow access tokens and expect you to (incorrectly) use id_tokens to call APIs.
In the current version of adal.js if the resource is the app it uses the Id token (maybe incorrectly) but otherwise access_token is supported.
They seem to have enabled CORS for their jwks endpoint now. Best to switch over or get caught out like we did with a cached copy of the old keys.
They seem to have enabled CORS for their jwks endpoint now. Best to switch over or get caught out like we did with a cached copy of the old keys.
Can you provide proof if they already enabled CORS? Thnx
It's really not hard to check - just open: https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration which will give you the JWKS url as: https://login.microsoftonline.com/common/discovery/v2.0/keys which gives the following headers on response now. Access-Control-Allow-Methods: GET, OPTIONS Access-Control-Allow-Origin: *
Not really sure why I should need to provide proof though? Just letting those affected know they should try again...