perarnborg / vuex-oidc

Vuejs (with vuex) wrapper for open id authentication
MIT License
232 stars 65 forks source link

Is vuex-oidc compatible with MS Azure ID? #205

Open matteogll opened 1 year ago

matteogll commented 1 year ago

This library works fine with my current identity provider (IdentityServer). Now I have to migrate a Vue 2 app from IdentityServer to Azure ID as identity provider. I guess this library should do the job (instead of rewriting code to use the official msal library). Is there an example on how to configure it for an Azure ID scenario?

Thanks

perarnborg commented 1 year ago

@matteogll the compatability question is more directed to the core library that this lib uses (oidc-client-ts or oidc-client pre v4).

I have no example to provide, but since Azure AD uses oAuth it should be compatible.

matteogll commented 1 year ago

Thanks @perarnborg, I got a working solution yesterday. I have to add /v2.0/ at the end of "authority" URL in order to properly pass scopes and get a valid access_token. I put it below if it can help somebody who is working with Azure as Identity Provider too. This configuration is for vuex-oidc library version >= 4

const identityAzureSettings = {
    authority: "https://login.microsoftonline.com/{tenant-id}/v2.0/", // I've added /v2.0/ to get a valid JWT access_token
    client_id: "{client-id}", 
    redirectUri: "http://localhost:8080/callback", 
    postLogoutRedirectUri: "http://localhost:8080",
    responseType: "code", 
    scope: "openid profile api://...",
    popupRedirectUri: "http://localhost:8080",
    silentRedirectUri: "http://localhost:8080/silent-refresh",
    automaticSilentRenew: true,
    filterProtocolClaims: true,
    loadUserInfo: false,
    includeIdTokenInSilentRenew: false, // https://github.com/IdentityModel/oidc-client-js/issues/172
};