0
I would like to update the Keycloak access token on nuxtJS login using the vuex-oidc library, but I get the invalid-Grant error when the token expires and the user is dropped. I need the user to stay logged in at all times and when the expired token is requested a new one via refresh_token.
Erro: .../protocol/openid-connect/token 400
I tried to add the following in oidcSettings:
export const oidcSettings = {
authority: process.env.oauth2.host,
clientId: process.env.oauth2.client,
redirectUri: `${process.env.baseUrl}/oidc-callback`,
responseType: 'code',
scope: 'openid email',
automaticSilentRenew: true,
automaticSilentSignin: true,
silentRedirectUri: `${process.env.baseUrl}/oidc-silent-callback`
}
and in oidc-Silent-callback I added the following:
import { vuexOidcProcessSilentSignInCallback } from 'vuex-oidc'
export default {
layout: 'empty',
name: 'OidcSilentCallback',
created () {
if (process.client) {
try {
vuexOidcProcessSilentSignInCallback()
} catch (err) {
// eslint-disable-next-line
console.error(err)
this.$router.push('/signin-oidc-error') // Handle errors any way you want
}
}
}
}
I did not understand very well if it is necessary automaticSilentSignin or if only with automaticSilentRenew should already make a token update request.