# Okta ideal state session expiration bug

**URL:** <https://devforum.okta.com/t/okta-ideal-state-session-expiration-bug/21792>\
**Category:** API\
**Tags:** api\
**Created:** [September 7, 2022, 9:50am UTC](https://devforum.okta.com/t/okta-ideal-state-session-expiration-bug/21792 "2022-09-07T09:50:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![karmjeet19](https://avatars.discourse-cdn.com/v4/letter/k/e56c9b/32.png) [@karmjeet19](https://devforum.okta.com/u/karmjeet19)\
**Post date:** [September 7, 2022, 9:50am UTC](https://devforum.okta.com/t/okta-ideal-state-session-expiration-bug/21792/1 "2022-09-07T09:50:02Z")

</div>

hi  
i am facing an issue with okta session api refresh when the application is in ideal state for more than 4 hr  
i have set the sign-on rule to expire after 15 days if session is in ideal state but still when i leave application for over 6hour (mostly at night around 8pm and then interacts with application next day in morning around 9am)

even though the life time is much greater my okta session some how expires  
how can i debug it

your help is much appreciated.

thank you

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [September 7, 2022, 8:18pm UTC](https://devforum.okta.com/t/okta-ideal-state-session-expiration-bug/21792/2 "2022-09-07T20:18:54Z")

</div>

What type of application is this, is it an OIDC app? Does the session expiration at all align with your configured token lifetimes? Custom authorization servers can have custom lifetimes, while the Org server has hard-coded lifetimes, see [What is the lifetime of the JWT tokens | Okta Help Center](https://support.okta.com/help/s/article/What-is-the-lifetime-of-the-JWT-tokens?language=en_US))

---

<div class="post-metadata">

**Author:** ![karmjeet19](https://avatars.discourse-cdn.com/v4/letter/k/e56c9b/32.png) [@karmjeet19](https://devforum.okta.com/u/karmjeet19)\
**Post date:** [September 8, 2022, 6:09am UTC](https://devforum.okta.com/t/okta-ideal-state-session-expiration-bug/21792/3 "2022-09-08T06:09:37Z")

</div>

yes it is OIDC and  
session expiration time is 30 days  
and token expiration is default ie. 60 min

what i am getting is that session is still active (checked it with oktaauth.session.exist()) but when i try to get token with token.getWithoutPrompt() then i am getting OAuthError: The client specified not to prompt, but the user is not logged in.  
this issue occurs when user comes to app after leaving it overnight

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [September 8, 2022, 4:17pm UTC](https://devforum.okta.com/t/okta-ideal-state-session-expiration-bug/21792/4 "2022-09-08T16:17:43Z")

</div>

Why not use a [refresh token](https://developer.okta.com/docs/guides/refresh-tokens/main/) to keep the user logged into the OIDC app? That way the application session is no longer reliant on the Okta session lifetime.

---

<div class="post-metadata">

**Author:** ![karmjeet19](https://avatars.discourse-cdn.com/v4/letter/k/e56c9b/32.png) [@karmjeet19](https://devforum.okta.com/u/karmjeet19)\
**Post date:** [September 8, 2022, 7:58pm UTC](https://devforum.okta.com/t/okta-ideal-state-session-expiration-bug/21792/5 "2022-09-08T19:58:23Z")

</div>

Can you please guide me to the configuration for okta-authjs for fetching refresh tokens  
and to use it for renewing accessToken

thanks

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [September 8, 2022, 8:17pm UTC](https://devforum.okta.com/t/okta-ideal-state-session-expiration-bug/21792/6 "2022-09-08T20:17:53Z")

</div>

Ensure that the app you are using has Refresh Tokens enabled as an allowed “Grant type”, found under Application → General → General Settings

As long as you configure the app to request the `offline_access` scope, okta-auth-js will handle the token renewals for you (provided you have autoRenew enabled).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [September 15, 2022, 6:28am UTC](https://devforum.okta.com/t/okta-ideal-state-session-expiration-bug/21792/7 "2022-09-15T06:28:02Z")

</div>

Closed on September 15, 2022, 6:28am UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
