
DylanJ.11480 (Customer) asked a question.
Since two weeks ago we have an issue where users get logged out if they close the app for 2 hours or longer. The refresh token becomes invalid and then Okta throws an error when trying to fetch a new access token. The lifetime of the access token is 1 hour and the lifetime of the refresh token is unlimited and invalidates if not used for 90 days. If opening the app after e.g 1h55 minutes the user stays logged in, the issue is only after the 2 hours have passed. Refresh token rotation is turned off and we've checked many times that we don't make calls with the old tokens to invalidate the whole token family. Okta returns invalid_refresh_token and we receive invalid_grant inside of the app.

Hi @DylanJ.11480 (Customer) , Thank you for reaching out to the Okta Community!
Okta session policies can enforce both idle timeout (inactivity-based expiration) and absolute session lifetime (maximum duration from authentication). When an absolute session lifetime of 2 hours is set on a Global Session Policy or Sign-On Policy, the session is automatically revoked after 2 hours have elapsed since initial authentication, regardless of whether the user is actively using the app. Once the session is revoked, the refresh token associated with that session is invalidated by the authorization server, causing the invalid_grant error.
Follow these steps to investigate and adjust your session policies:
The distinction between idle timeout and absolute session lifetime is critical: idle timeout only expires the session if the user is inactive, while absolute session lifetime expires the session after a fixed duration regardless of activity. Your refresh token configuration (1-hour access token, unlimited refresh token with 90-day inactivity expiration) is separate from the session lifetime policy and will not prevent this behavior if the session itself is revoked.
If your implementation is in relation to a Custom Authorization Server, my advice would be to reach out to our Okta Developer colleagues via devforum.okta.com to take advantage of their expertise.
While we'll do our best to answer all of your questions here, this medium is more inclined towards Okta general questions around core products and features (non-custom/developer work)
If my answer helped, remember to mark it as best to increase its visibility for other members of the Okta Community who might have the same questions as you.
Hope my answer helps!
--
Help others in the community by liking or hitting Select as Best if this response helped you.
Collect them all. Learn a new skill and earn a new Okta Learning badge.
Just released: More Okta Community badges just added