want to make user loggedin for long time how can i implement it?
- 0
- Web
- Android
- Accounts
- Apple
- Users
first two images are for login
i used it signed up and logged into home screen after exiting app i am again redirected to login page i should login again and again..... how can i handle this problem how to make user to stay logged in for long time?
What I usually do is have a block of code in the login/signup page (whichever is your default), that first checks whether the user has an active session.
If they have an active session, redirect them to the suitable page. If they don't have a session, stay on the page and ask them to login/signup
a simple way to do this is to use account.get()
ohh okay
Essentially, if the user has an active session, account.get()
will return a response. If there is no session, you will get an AppwriteException
, that you can catch.
@Ahmed if you have any other questions in this particular topic, please tag me and ask away! For questions on a different issue, please make a new post π
Let me know how it goes!
why new post @safwan ?π₯²
i'll ask question itself here.
no like, if you have question about a different issue, make a new post.
ohh okay boss
if it's the same issue, feel free to ask here!
can we use asyncStore with it
?
Hey sorry for the late reply just saw this message.
asyncStorage
is used for persisting data on the device. What do you want to store on the device when a user logs in?
@Ahmed
Recommended threads
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...