How to keep a user authenticated until he logs out manually ?
- 0
- Web
- Databases
- Accounts
- General
- Users
Now, I'm doing a task manager project like Trello so it is natural that the user should be kept until he manually logs out from the app. How can I keep the user authenticated until log out?
- if I use
ApiKeyit gets other users' data - if I use
JWThas a fixed 15-minute limit (and there is no feature likerefresh token)
Is there any best practice?
@Мухаммадамин You are using server SDK with JWT for fetching user specific data from database. now while you are using JWT, i believe you are also using client SDK to createJWT?
according to this docs: https://appwrite.io/docs/products/auth/jwt
You need user to be logged in using client SDK to create JWT token, and you can always create new JWT token if the request fails and try again. because user will be logged in until logs out manually or whatever session length you have set from Appwrite console auth.
So basically, you can approch it like this: you can read the error response of failed request and in case of expiry of existing JWT token, create new JWT and send new request with that JWT.
It's really great idea, thank you again! I'll try this way.
I'll leave this post unsolved for a few days, maybe others have ideas to share
Recommended threads
- Transaction Error
AppwriteException: Transaction with the requested ID could not be found. at Generator.next (<anonymous>) { code: 404, type: 'transaction_not_found', r...
- Can not get the logged in user data in N...
I'm trying to get the user data after i log in with otp but it get this error : AppwriteException: User (role: guests) missing scopes (["account"]) at Gen...
- Auto Updating Backend & Auth via Appwrit...
<@870607367597850624> Hey everyone 👋 I wanted to ask to ask for a friend, he’s asking if Appwrite be used in a similar way to Supabase when integrated with AI ...