How can I extend session expiry? #3021
Replies: 3 comments 8 replies
-
Did you find any way of extending the "exp"? I also need to do this to allow my web app users to authenticate within a CLI. |
Beta Was this translation helpful? Give feedback.
3 replies
-
I think I found the solution. The docs aren't too clear on this, but you have to create a JWT template to define a custom expiration. Once created, the getToken() function has a parameter called template which is where you put the name of the JWT template you created.
I just spent 2 hours trying to figure this out so I hope it helps someone. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Brief Question
I would like to extend the session expiry (
"exp"
). Currently, it seems to be set to 60 seconds. For reasons explained at more length in the next section, I would like to extend it rather significantly.The session docs claim that the
"exp"
field is "[d]etermined using the Token lifetime JWT template setting in the Clerk Dashboard.". However, I modified this up to 604,800 (1 week) to test it yesterday and it has had no effect.Does anyone know how I can address this?
Detailed Summary of Issue
NOTE: The above is a workaround fix for the issue I am experiencing below. The below is more complex, and I welcome any advice that helps to address the issue more directly.
I have a (1) Webapp, and (2) a Chrome extension (primarily run as a "New Tab"), both coded in Sveltekit. I would like to share session state between the two. This works, so long as the webapp is open in a separate tab. However, after the webapp is closed, the session within the extension expires with 60 seconds. Though the frontend session is still recognize (and the
<SignedIn />
component therefore still functions properly), the backend rejects all requests, claiming that the session token ahs expired.I have tried adapting the @clerk/chrome-extension to work with SvelteKit, but it has resulted in no success. Additionally, it is worth noting that I have followed the steps outlined in the @clerk/chrome-extension README, including disabling URL-based session sharing in dev/staging and adding the extension to
allowed_origins
.I am not sure if I am settings my settings wrong or otherwise handling the session-sharing wrong.
Please let me know if you have any advice, or if any more information would in evaluating the issue.
Beta Was this translation helpful? Give feedback.
All reactions