
da1cw (da1cw) asked a question.
I need to renew my token automatically after it expires. I followed the instructions provided on the following link:
I configured the autoRenew property in the token manager as true:
tokenManager: {
autoRenew: true
},
I coded the expired function like this:
window.signInWidget.authClient.tokenManager.on('expired', function (key, expiredToken) {
debugger;
console.log('Token with key', key, ' has expired:');
console.log(expiredToken);
});
And the renewed function is coded like this:
window.signInWidget.authClient.tokenManager.on('renewed', function (key, newToken, oldToken) {
debugger;
AuthenticationToken.set(newToken);
console.log('Old token:', oldToken);
console.log('New token:', newToken);
});
The problem that I have is that only the expired function is called when the token expires, but the renewed function is never called.
How can I make the renewed call work?

Hello. This is Cosmin from Okta Support.
The auto renew functionality relies on having access to the Okta session cookie, which is seen as third party in this scenario.
https://github.com/okta/okta-auth-js#third-party-cookies.
If you require any more assistance on this, feel free to open a new ticket with our support team.