sign_out
does not remove the session from storage if the API request raises an exception
#656
Open
2 tasks done
Labels
bug
Something isn't working
Bug report
Describe the bug
supabase.auth.sign_out()
makes an incorrect use ofcontextlib.suppress
.From the docs:
This means that
sign_out
does not execute anything afterself.admin.sign_out(...)
if that method throws an exception (for example if the jwt has expired, or if the session has already been deleted from the db), because all the code after the call is still inside the context manager.So in the case of a non-200 response from the API the following code never gest executed:
And the session is not removed from storage.
You may also want to update the docstring of the method, as it was copied from the js client and is not accurate to what the method actually does.
It may be a good idea to check for other incorrect uses of
contextlib.suppress
too.To Reproduce
auth.sessions
table in the dbsupabase.auth.token
key is still presentExpected behavior
The python client should correctly handle errors during the
self.admin.sign_out()
call and execute the following block of code regardless.The only needed modification is to unindent the block of code after that call.
The text was updated successfully, but these errors were encountered: