-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
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
Okta refresh token not working. Expired and renew events not triggering #1437
Comments
What version of Can you confirm you're only constructing a single |
I am only constructing one instance of oktaAuth. I was using the prepacked okta-js version in okta-react 7.0.0 but I have tried with the latest 7.3.1 too and it doesn't work |
@igloo12 Can you share more information about how you observe token expiration happen? You can use expireearlyseconds config to observe token expiration (DEV mode only). Internal Ref: OKTA-631863 |
@shuowu-okta It seems the issue is when the App is background. When I set the expireearlyseconds I see the token refresh as expected. But if I leave the app minimized and come back later the events don't fire and the token is expired |
We faced similar issue, since it seems that browser puts background/inactive tabs in a sleep mode after certain time. |
We are facing the similar issue, token auto renew is not happening when the user minimize the tab. Also the when user stays in same path its not getting renewed. is there any fix for this ? |
Hi @fseee , we are also facing same issue in angular application, like when the tab is minimized or the screen is locked and when we come back token renewal is not happening. And you have mentioned about web workers, can you please share your code like how you integrated the web worker in your app, so that it would be helpful.. or any other solution is also would be appreciated. Thanks in advance. |
@ugandhar1995 Can you paste your versions and your OktaAuth config (please omit sensitive fields)? I'm curious if you're using the |
sure @jaredperreault-okta okta: { |
In version |
@ugandhar1995 we got rid of the web worker since we solved the issue by using the session.refesh() method before requesting new tokens. |
Thanks for your suggestion, will try it out and post my experience here, since we face this issue when working in multiple tabs. Hope this helps our problem. |
@fseee Are you using refresh tokens (aka |
If you are using session api to get it work, consider to move to sessionStorage because session api uses thirdparty cookies and some browser could start to block those cookies. |
I'm not sure I see the correlation between sessionStorage and 3p cookies. I recommend using localStorage (the SDK's default) in almost all cases. Using a non-shared storage location can cause odd UX when using multiple tabs of the same app And mitigating 3p cookie concerns can be done by using a Custom Domain, so your Okta IDP and your web app reside on the same domain (or etld+1). But your point about avoiding 3p cookies is a one good one |
Describe the bug
I am trying to get the refresh token to trigger automatically. I am using okta-auth-js with the okta-react library. I am listening to the token events added, error, expired, renewed. The only event that fires is the added event.
Reproduction Steps?
Sign in and wait for the token to expire. No event is triggered
SDK Versions
System:
OS: macOS 13.4.1
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 719.52 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.2.0 - /usr/local/bin/node
npm: 9.6.6 - /usr/local/bin/npm
Browsers:
Chrome: 114.0.5735.198
Safari: 16.5.2
npmPackages:
@okta/okta-react: ^6.7.0 => 6.7.0
Additional Information?
No response
The text was updated successfully, but these errors were encountered: