Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable user profile remove event (unsetOidcAuth) #182

Open
alexdeia opened this issue Feb 9, 2022 · 2 comments
Open

Disable user profile remove event (unsetOidcAuth) #182

alexdeia opened this issue Feb 9, 2022 · 2 comments

Comments

@alexdeia
Copy link

alexdeia commented Feb 9, 2022

Hi. I need to keep profile data in oidcStore.profile (like firstname, lastname, etc), but removing invokes after accessTokenExpiring event.

I found this row and I tried to disable this:

context.commit('unsetOidcAuth')

oidcUserManager.events.addAccessTokenExpired(() => { context.commit('unsetOidcAuth') })

but I guess vuex-oidc doesn't provide that or is it possible? In short, I want to enable/disable this event (for example, in offline I can disable it and enable if app is online).

This part of code doesn't work as I guessed because unsetOidcAuth is invoked always.

    accessTokenExpired: () => {
      ...something
    },

What am I doing wrong?

@perarnborg
Copy link
Owner

Sorry for not replying sooner!

I think this I this should only have removed the access token from the store rather than the whole profile - since the event is thrown when the access token expires.

Even if the id token is expired I think you still are allowed to use the information in it as long as it was valid when the client received it. 🧐

I think I will change this soon, let me just look into it a bit more first!

@perarnborg
Copy link
Owner

@alexdeia as of v3.11.0 there is a new storeSetting attribute called removeUserWhenTokensExpire that is set to true by default. If you set it to false I think you will get the behaviour you want!

vuexOidcCreateStoreModule(oidcSettings, { namespaced: true, removeUserWhenTokensExpire: false })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants