question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trigger updateToken

See original GitHub issue

Thanks for this helpful plugin.

I understand that there is an implicit token refresh, but I would like to trigger updateToken() before making an API call (or) as a part of error handling of an 403 response, like how it’s mentioned in the JS adapter docs. How do I do this?

I did try $keycloak.updateToken but this function is not exposed with the $keycloak instance. Is there any other way? Thanks in advance!

keycloak.updateToken(60).then(function() {
    makeAPICall();
}).catch(function() {
    alert('Failed to refresh token');
});

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nliencommented, Oct 15, 2020

If updateToken() from the Keycloak JS adapter is the only thing that’ll help, I guess this function also has to be exposed.

I’m wondering if it’s better to just expose the whole Keycloak object altogether, acting like a proxy, so every function/property is exposed always…

0reactions
baltomcommented, Oct 27, 2020

@CryptoZorro this should now be possible with version 1.3.1+ by doing Vue.$keycloak.keycloak.updateToken(60)

Read more comments on GitHub >

github_iconTop Results From Across the Web

KEYCLOAK - Refresh/update token not working - Stack Overflow
In your code You never see the token refreshed because the refresh is never triggered in the 15 seconds window in which will...
Read more >
Refresh the token at some fixed interval rather than ... - GitHub
Can we have simple solution to set the minValidity as a prop in config and then use it for triggering the updateToken method....
Read more >
Update token after updating user info - Auth0 Community
When updating the currently logged in user information in our application, we are successfully sending the new information to Auth0, ...
Read more >
keycloak.js - 400 on token refresh after a long period of ...
... js app - all calls trigger a call within Keycloak refresh token get 400. ... token has actually expired and hence the...
Read more >
Using the refresh token - Amazon Cognito - AWS Documentation
As a best practice, applications should redirect users to the logout endpoint to force the browser to clear session cookies. An application can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found