Skip to content

Error: Could not read access token  #7

@dawid096

Description

@dawid096

Hello,
I have problem when I implement vueKeycloak to my Vue 3 project.
I implement basic config options (options does work in keycloak-js library) and on page load after few seconds I get error in console

Uncaught (in promise) Error: Could not read access token
at initKeycloak (index.esm.js?08aa:98)
at async Object.install (index.esm.js?08aa:156)

this is where i get this error:

async function initKeycloak(initConfig) {
try {
isPending(true);
const _isAuthenticated = await $keycloak.init(initConfig);
isAuthenticated(_isAuthenticated);
if (!isNil($keycloak.token)) {
setToken($keycloak.token);
}
$keycloak.onAuthRefreshSuccess = () => setToken($keycloak.token);
$keycloak.onTokenExpired = () => updateToken();
}
catch (error) {
hasFailed(true);
isAuthenticated(false);
throw new Error('Could not read access token');
}
finally {
isPending(false);
}
}

Do you have any idea why do I have this error?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions