We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subscribes a callback that will be called when the authStateChange event happens. not triggering after 1hr token expiration or idle mode
version:
"@okta/okta-auth-js": "7.8.1", "@okta/okta-react": "6.9.0", "@okta/okta-signin-widget": "7.24.2",
export const getOktaAuth = () => { return new OktaAuth({ clientId: OKTA_CLIENT_ID, redirectUri: `${window.location.origin}/authorization-code/callback`, useClassicEngine: true, issuer: `${OKTA_API_BASE}/oauth2/${OKTA_AUTH_SERVER}`, pkce: true, url: OKTA_API_BASE, tokenManager: { storageKey: 'mycrm-tokens', }, transformAuthState: async (oktaAuth, authState) => { if (!authState.isAuthenticated || !!authState.oktaUser) { return authState; } const user = await oktaAuth.token.getUserInfo(); authState.isAuthenticated = !!user; authState.oktaUser = user; return authState; }, }); };
export const onRefreshExpirationToken = async () => { // trigger every 1hr const oktaAuth = getOktaAuth(); oktaAuth.authStateManager.subscribe(async (authState) => { console.log("authState==", authState); if (authState.isAuthenticated) { const newToken = authState.accessToken?.accessToken; LocalStorageProxy.token = newToken; } }); oktaAuth.authStateManager.updateAuthState(); };
"@okta/okta-auth-js": "7.8.1", "@okta/okta-react": "6.9.0", "@okta/okta-signin-widget": "7.24.2", ``` ### Additional Information? _No response_
The text was updated successfully, but these errors were encountered:
fixed by adding oktaAuth.start(); https://github.com/okta/okta-auth-js?tab=readme-ov-file#running-as-a-service
oktaAuth.start()
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Subscribes a callback that will be called when the authStateChange event happens. not triggering after 1hr token expiration or idle mode
version:
Reproduction Steps?
SDK Versions
version:
The text was updated successfully, but these errors were encountered: