kc.updateToken cannot access kc.refreshToken

I’m trying to integrate keycloak-js into my web app but I’m not able to use kc.updateToken()

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
[KEYCLOAK] Estimated time difference between browser and server is 1 seconds
index.js:16 — After Init; Before Update —
index.js:17 Access Token: eyJhbGciOiJSUzI1NiIsInR5cCZxiNLT4gnf39P-zdpGRKCpg
index.js:18 ID Token: eyJhbGciOiJSUzI1NiIsInR5cCIgOi1KMpLCwFObm5nXntMaRnPrg
index.js:19 Refresh Token: eyJhbGciOiJIUzI1NiIsInR5cYNDM3tAWM6GA4oIoXqs-CAY
keycloak.js:1759 [KEYCLOAK] Refreshing token: token expired
keycloak.js:696 POST https:///protocol/openid-connect/token 400
keycloak.js:1759 [KEYCLOAK] Failed to refresh token
index.js:28 — updateToken().catch() —
index.js:29 Access Token: undefined
index.js:30 ID Token: undefined
index.js:31 Refresh Token: undefined

How I’m using it (currently for testing)
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
})
}
})

I’m using v15.0.2