[keycloak-user] Possibility to get the keycloak session timeout value per Java-Script

Marek Posolda mposolda at redhat.com
Fri Feb 6 06:26:42 EST 2015


We have 2 timeouts related to session:

- Idle timeout: it's 30 minutes by default. It is refreshed after each 
token refresh or successful SSO login. In other words, in your 
Javascript application, you need to perform token refresh at least once 
per 30 minutes. The timeout is available on refreshToken and can be 
checked in your JS application by "keycloak.refreshTokenParsed.exp"

- Max session lifespan: It's 10 hours by default. This is really maximum 
timeout of each session from login time. Even if you refresh your token 
each 30 minutes, after 10 hours will be session expired and your user 
would really need to get redirected to KC login screen and 
re-authenticate. This is not available in JS app afaik, but people still 
need to re-authenticate after this time, so I think it's not an issue.

All timeouts are configurable. See 
http://docs.jboss.org/keycloak/docs/1.1.0.Final/userguide/html/timeouts.html

Marek

On 3.2.2015 10:59, Christoph Machnik wrote:
> Hi,
> thanks for the answer, but i want to know the value of the sessioin 
> timeout (red) and the "isTokenExpired(X)" is for the accessToken value 
> (blue).
>
>
>
> Is there a possibility to get this value (red) in Java Script ?
>
> ------------------------------------------------------------------------
> *Von:* Marek Posolda [mposolda at redhat.com]
> *Gesendet:* Montag, 2. Februar 2015 23:14
> *Bis:* Christoph Machnik; keycloak-user at lists.jboss.org
> *Betreff:* Re: [keycloak-user] Possibility to get the keycloak session 
> timeout value per Java-Script
>
> Hi,
>
> on keycloak.js there is function "isTokenExpired()" which can be used 
> to check if token is expired. You can also give it an argument like 
> "isTokenExpired(10)", which will return true if token is expired *or* 
> is going to expire in next 10 seconds. Some more info in the docs: 
> http://docs.jboss.org/keycloak/docs/1.1.0.Final/userguide/html/ch08.html#javascript-adapter
>
> Marek
>
> On 2.2.2015 13:09, Christoph Machnik wrote:
>> Hi,
>>
>> I want to show an info, befoe the session runs in a timeout, so that 
>> the user can react and not be logged out. For this i need to read the 
>> session timeout that is configuresd in the keycloak admin console. is 
>> there a possibility to get the timeout value in javascript ?
>>
>>
>>
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20150206/f04c9f46/attachment.html 


More information about the keycloak-user mailing list