Hi, How can I delete my user and remove its sessio...
# general
b
Hi, How can I delete my user and remove its session from React Native ? I am deleting my user in my api and it's working perfectly but it is not removing my client session.
r
hey @binouse
session verification happens in a stateless way in the backend, so when it refreshes, the session should be cleared on the frontend
b
I thought it was the case too but figured out that
doesSessionExist
still returns true even when user does not exists in db
r
yeaaa.. thats the disadvantage of using stateless session verification
but it's a smaller issue compared of the benefit of it
b
How can i remove my session then
r
also, in your code, when you detect this inconsistency, you can throw an unauthorised error on the bakcend which will result in clearing the cookies anyway
you can return a 401 to the frontend. That should trigger a session refresh, which will detect that the session doesn't exist -> log out the user
b
Okay, calling
Supertokens.signOut()
after deleting user refresh the session
Perfect, thanks ๐Ÿ˜Š
r
oh yea.. you can call that from the frontend, and it would work
b
Yep, itโ€™s easier
r
yup
9 Views