We are trying to implement auto logout with the help of idle session timeout from global session policy.
The "Expire session after user has been idle on Okta for" was set to 15 minutes. From client side application we have ensured to have no user interaction once the user is logs in. Auto renew was set to false in order to prevent automatic token requests. Even after completing the idle timeout, the user was still logged in.
we were not able to identify any events getting triggered at the time of idle session timeout. Could you please let us know why the user was not logged out even after idle session timeout?
Please find the configuration used while testing the above scenario
Access token lifetime is: 5 minutes
Expire session after user has been idle on Okta for: 8 minutes
Refresh token lifetime is: 10 minutes
Refresh token expire if not used every: 10 minutes
Can you provide a little more info about your setup? Specifically, are you using the Okta-hosted redirect login, embedded sign-in widget, custom login, or something else? Are you using @okta/okta-angular and @okta/okta-auth-js SDKs?
It would be great if you could provide some updates on the query. Please let me know if you need any further information from me. I appreciate your time and consideration.
Is the refresh token still valid after the userās Okta session has expired? Based on your description, I would expect the following:
Start
User logs into Okta: new Okta session created, will expire in 8min
Access token (expires in 5min) and refresh token issued (expires in 10min)
+5 minutes
Access token has expired. Our Angular SDK will automatically renew tokens for you
new Access token (expires in 5min) and refresh token issued (expires in 5min)
Okta session expires in 10 minutes (unchanged, as Okta session was not for the refresh)
+8 minutes
Okta session has expired
User remains logged into application as application session is still valid (access token is valid for 2 more minutes, refresh token for 7min)
+10 minutes
Access token has expired. Our Angular SDK will automatically renew tokens for you
new Access token (expires in 5min) and refresh token issued (expires in 0min)
+15 minutes
Access token has expired. Refresh token is also expired. Angular app will redirect user back to Okta to login.
^^ is this the sequence you see occurring? Do you still see additional renewals after this point? If so, what do you see when you introspect the refresh token?
Since you set the refresh token lifetime to a max of 10minutes, a new /authorize request would need to occur in order for the user to remain logged into your application after the 10minute mark. This could be completed by the SDK itself (within a hidden iframe). Do you see /token requests every 5 minutes (aka, when your access token expires)? Do you ever see another /authorize request? If so, what does it look like (e.g. does it have prompt=none attached and response_mode=okta_post_message)?
Please have a look into our observation which is given below
Start
User logs into Okta: new Okta session created, will expire in 8min
Access token (expires in 5min) and refresh token issued (expires in 10min)
+5 minutes
Access token has expired. Automatic token renew was set to false using the configuration tokenManager: { autoRenew: false }
Automatic token renew was not triggered
Okta session expires in 10 minutes (unchanged, as Okta session was not for the refresh)
+8 minutes
Okta session has expired
+9 minutes
A token renew request was triggered by invoking tokenManager.renew('refreshToken) method
new access token was received,
I was not expecting the last token request (at +9 minutes) to success since the Okta session was supposed to expire at the 8th minute. Trying to understand what could have caused this behavior or is this an expected behavior?
The access and refresh token lifetimes are separate from the Okta session lifetime. Even if the Okta session has expired, as long as the userās tokens are still active, they will remain logged into the application.
like you have mentioned āaccess and refresh token lifetimes are separate from the Okta session lifetimeā, does the ākeep me signed inā or āremember meā setting have any impact on refresh token and access token lifetime.? If so how would the token expiry change if user select ākeep me singedā option while logging in (using widget).?
Also it would be great if you could share some configuration if any, that can be used to manage application idle timeout. Our intention is to have the user automatically log out after a specific period of inactivity. We expect that specific idle time value be some settings on Okta.
Nope, neither of those settings will affect the token lifetimes.
I donāt know of us having any specific guidance about application idle timeouts, but, in general, if you want to completely log a user you, you will want to