kc.refreshToken returns as undefined in kc.updateToken #8526
Unanswered
smantel-ch
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Whenever I want to use kc.updateToken the post request fails with 400 because the form data refresh_token is "undefined":
kc.updateToken cannot access kc.refreshToken
https://github.com/keycloak/keycloak/blob/master/adapters/oidc/js/src/main/resources/keycloak.js#L651
Form Date of the POST request from the browser to keycloak looks like this:
grant_type=refresh_token&refresh_token=undefined&client_id=clientId(notice the refresh_token=undefined)
console.log trace
code to reproduce
kc.init({ onLoad: 'check-sso', silentCheckSsoRedirectUri: window.location.origin + '/silent-check-sso.html', pkceMethod: 'S256', promiseType: 'native', enableLogging: true, }) .then((authenticated) => { if(authenticated) { console.log('--- After Init; Before Update ---') console.log('Access Token: ' + kc.token) console.log('ID Token: ' + kc.idToken) console.log('Refresh Token: ' + kc.refreshToken) kc.updateToken(5) .then(() => { console.log('--- updateToken().then() ---') console.log('Access Token: ' + kc.token) console.log('ID Token: ' + kc.idToken) console.log('Refresh Token: ' + kc.refreshToken) }) .catch(() => { console.log('--- updateToken().catch() ---') console.log('Access Token: ' + kc.token) console.log('ID Token: ' + kc.idToken) console.log('Refresh Token: ' + kc.refreshToken) }) } else { kc.login({ redirectUri:${window.envConfig.WEB_BASE_URL}/dashboard}) } })Any idea what I'm doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions