Back

[Solved]Way to create long running JWT sessions

  • 2
  • Users
  • Accounts
  • Web
Ajit Singh
27 Oct, 2023, 07:35

Is there a way I can create a long running JWT session.

I want to create a native session in my mobile app I am using function for that and sending a JWT back for login I want that JWT to work for a long time in the app is there any way to make this long running JWT session.

TL;DR
To create a long-running JWT session in your mobile app using Appwrite, you can follow these steps: 1. Instead of relying on Appwrite's JWT for session management, use the Appwrite cookie or fallback header. 2. The cookie or fallback header can be obtained by making a request to `<https://appwrite.io/docs/apis/rest#client-integration>`. 3. Look for the `X-Fallback-Cookies` section on that page for more information. 4. When the JWT expires, instead of trying to extend its duration, create a new JWT. 5. Currently, it is not possible to specify the duration of the
Ajit Singh
27 Oct, 2023, 09:22

Way to create long running JWT sessions

D5
27 Oct, 2023, 14:12

For now it's not possible to specify JWT duration

D5
27 Oct, 2023, 14:12

Instead you should create a new JWT

D5
27 Oct, 2023, 14:12

When it expires

Drake
27 Oct, 2023, 18:52

I would suggest using the Appwrite cookie or fallback header instead of Appwrite's JWT

Ajit Singh
28 Oct, 2023, 01:37

Can you tell me how to do that

Drake
28 Oct, 2023, 02:27

https://appwrite.io/docs/apis/rest#client-integration

Also look on that page for the X-Fallback-Cookies

Ajit Singh
28 Oct, 2023, 06:50

Can I get the cookies without setting a password

Drake
28 Oct, 2023, 15:32

There's no way to make a session out of nothing at the moment. You might want to 👍 this issue: https://github.com/appwrite/appwrite/issues/3891

Ajit Singh
29 Oct, 2023, 02:02

Thanks

Ajit Singh
29 Oct, 2023, 11:50

[Solved]Way to create long running JWT sessions

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more