The guide for server side auth states users should use the cookie secret to validate a user :
account= Account(sessionclient).setsession(cookie)
account.get()
How would i retrieve a session, i don't want to set a new session on each login?? getsession seems to take sessionid as a parameter....but the guide on appwrite says the cookie should be set as the secret. so how does that work? seet another cookie or store in local storage the session id?
Yes, you have to persist on login. Something has to persist somewhere.
Set another cookie? What do you mean?
what do you mean persist on login? - by set another cookie i mean set another cookie with the session id so the getsession function works
A session must be persisted. The session can be persisted in a single cookie. When you say "another" it sounds like there are multiple, but I'm not sure what other cookies you're referring to
the guide says i should set the cookie as the 'secret' when a session is created. The cookie is validated in the code i've mentioned- i.e setsession(cookie secret). How can i validate a session?? set session seams to create a session everytime it is called .....I want to validate an existing session. what im asking is as simple as it gets. How can someone validate an authorised user....your guide only mentions a cookie with a secret value inside. This cannot be used to get_session() as that func requires a session id....so how does appwrite suggest i manage the sesssion id?another cookie? i already have a persisted cookie with the secret.
You validate the session by making an account.get() API call.
There is no ID you need to keep track of
sir......account .get needs to be set by a cookie according to your guide! Account(sessionclient).setsession(cookie) -----> account.get() if i just call account.get() how will it know who's account? This is incorrect. What i'm asking is painfully simple.
it also seems to create a newsession each time setsession is called. This not how validating a user works.
I want to validate a user ie use get session. getsession func requires session id whch i have not been advised on how or where to store.
client.setSession() sets the session on the client so that all subsequent requests with that client will make the authenticated request.
Not sure what you're talking about. SetSession doesn't make any API calls. It just sets a property in the Client object
Recommended threads
- Android SDK: Kotlin null Value Not Updat...
Hi team, I think you should check the Android SDK implementation once, as it seems to have an issue handling Kotlin **null** values. For example: When I send:...
- Can't connect GitHub — 500 error at the ...
Appwrite Cloud, Pro plan, SFO region. All my Git connections vanished today — Sites and all 15 Functions now show no repository connected. When I try to add a ...
- vorafy.studio domain already exists erro...
My domain vorafy.studio is stuck/locked from a previously deleted project. I created a new project but can't add the domain — getting 'already exists' error. Pl...