Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refresh_session always throws an error #353

Open
Slumberdac opened this issue Oct 21, 2023 · 1 comment
Open

refresh_session always throws an error #353

Slumberdac opened this issue Oct 21, 2023 · 1 comment
Labels
bug Something isn't working Stale

Comments

@Slumberdac
Copy link

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

  1. Sign in a session using supabase.auth.sign_in_with_password(email, password) into a variable (e.g. session)
  2. Sign out
  3. store the session's access and refresh tokens in cookies
  4. 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)
  1. Exception raised

System information

  • Windows 10
  • Version of supabase-py: 1.0.3
  • Version of Python: 3.11.1
@Slumberdac Slumberdac added the bug Something isn't working label Oct 21, 2023
Copy link
Contributor

This issue is stale because it has been open for 365 days with no activity.

@github-actions github-actions bot added the Stale label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

1 participant