Description
Bug report
Describe the bug
So this has been an ongoing issue for a few weeks, whenever i run supabase.auth.refresh_session while including the refresh token, i keep receiving this error : gotrue.errors.AuthApiError: Invalid Refresh Token: Refresh Token Not Found
I've tried going through all of the steps refresh_session makes to find where my refresh_token might get lost, i've found that it is never really lost, rather the exception occurs when response gets initialised on line 73 of httpx/_auth.py
response = yield request
When printing response.read() i receive this reply : b'{"error":"invalid_grant","error_description":"Invalid Refresh Token: Refresh Token Not Found"}'
but request still holds my refresh token
Is there something wrong with my usage of refresh_session or a different way to do this i should follow ?
To Reproduce
- Sign in a session using
supabase.auth.sign_in_with_password(email, password)
into a variable (e.g. session) - Sign out
- store the session's access and refresh tokens in cookies
- Using pyJWT, check if access_token from cookies is expired, if so set :
try:
jwt.decode(access_token, algorithms=["HS256"])
except jwt.InvalidSignatureError:
# Signature has expired
auth_response.set_cookie(
key='access_token',
value=settings.supabase.auth.refresh_session(
refresh_token).session.access_token)
- Exception raised
System information
- Windows 10
- Version of supabase-py: 1.0.3
- Version of Python: 3.11.1