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
- Functions not executing after usage rese...
Hi team, Last month my project hit 100% usage and functions stopped working (expected). Now the new month has started and usage has reset, requests are going ...
- Functions never end and always fail (sta...
Hi ! I'm using Appwrite Cloud Pro and function execution from appwrite website is KO. Deploying starter function template, execution is always Failed and the ...
- My function executions console if overwh...
It seems the requests are getting processed correctly but it is using a older version of the backend. And it seems the cron requests done an hour ago are shown ...