Replies: 2 comments 2 replies
-
Just to provide an update after some further investigation, I found that the correct way to pass the scope parameter is by using the options dictionary format like this: options = {"scope": "local"} # or "global" or "others"
response = await supabase.auth.sign_out(options=options)
print("Sign-out response:", response) This resolves the earlier issue where the scope was not recognized. The error no longer appears, but the problem now is that even with "scope": "local", the sign-out still affects all sessions, not just the current session. Here are the logs:
I also checked the Supabase auth.py codebase in the GitHub repo and confirmed that the options parameter is correctly accepted as part of the sign_out() method. this is my code async def sign_out(self, device_id: str):
try:
supabase = await self._get_supabase()
# First terminate the device session
await supabase.table('device_sessions')\
.update({'status': 'terminated'})\
.eq('device_id', device_id)\
.execute()
# Then sign out from Supabase auth
options = {"scope": "local"} # or "global" or "others"
response = await supabase.auth.sign_out(options=options)
print("Sign-out response:", response)
return {
"message": "Signed out successfully",
"success": True
}
except Exception as e:
print("Error during sign-out:", e)
logger.error(f"Failed to sign out: {str(e)}")
raise SessionError("Failed to sign out", 500) However, it still signs out all sessions instead of only the current session. If anyone has experienced this or found a solution, any help would be appreciated! |
Beta Was this translation helpful? Give feedback.
-
anyone with solution ? |
Beta Was this translation helpful? Give feedback.
-
Hey everyone, I'm using Supabase Python SDK and trying to sign out a user only from the current session while keeping other sessions active. I saw in the docs that sign_out() supports a scope parameter ("global", "local", "others"), but when I try:
await supabase.auth.sign_out(scope="local")
I get an error saying scope is not recognized. However, await supabase.auth.sign_out() works, but it removes all sessions instead of just the local one.
Is the scope option not implemented in Python yet? If so, is there any workaround for signing out of only the current session? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions