Back

logout func failing

  • 0
  • Auth
cryptobitez
13 May, 2024, 23:19

Log out func is failing- acount.get() works in all other endpoints but here for some reason. I read the cookie, set the session and then delete the session doesnt work. Everything works until account.get() and deletesession(). Anyone know why?? how can it set a session that it can't delete in the same breath? error is : User (role: guests) missing scope (account)

Here is the api endpoint

TypeScript
async def logout( request: Request):
  cookie= request.cookies.get('login')
  print(cookie)
  if not cookie :
     raise HTTPException(status_code=401, detail="Already logged out")
  try: 
    sessionclient.set_session(cookie)
    account=  Account(sessionclient)
    print('session set')
    account.get()
    print('account gotten')
    account.delete_session("current") ; 
    return { 'log out succesful'}```
TL;DR
Developers experiencing issues with logout functionality due to failures in account.get() and account.delete_session(). The error message indicates a missing scope for 'guests'. Ensure correct access levels. Use of admin client also suggested but did not work. Format code with three backticks.
ideclon
13 May, 2024, 23:34

Is it possible set_session() is failing?

ideclon
13 May, 2024, 23:35

And BTW, it’s best to format code by surrounding it by three backticks (```)

cryptobitez
13 May, 2024, 23:48

it doesnt fail, everything works until account.get()/deletesesssion()

cryptobitez
13 May, 2024, 23:49

maybe it should be done using admin client?* note- that didnt work either.

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