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

JWT token expiary #1047

Open
2 tasks done
dikovmaxim opened this issue May 15, 2024 · 0 comments
Open
2 tasks done

JWT token expiary #1047

dikovmaxim opened this issue May 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dikovmaxim
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

I was developing an app using React Native and SupabaseJS and suddenly started to get errors:
{"code": "PGRST301", "details": null, "hint": null, "message": "JWT expired"}

I reauthorized in my app and everyrithing worked, but the next day it started again. I tried to increase the JWT lifetime in auth configs, but didnt really help. My biggest issue is, that the function I wrote:
export async function checkAuth(){ const { data, error } = await supabase.auth.getSession() if (error) { console.log(error.message) return false } return true }

does not catch the expiary and still returns true. I know I could have tried to somehow catch the token expiary and hanldle it manually but there definetly should be a propper way to do it automatically. At least according to documentation.

Here is my code (copied 1:1 from docs) which always worked until now
export const supabase = createClient("https://....supabase.co", "...", { auth: { storage: AsyncStorage, autoRefreshToken: true, persistSession: true, detectSessionInUrl: false, }, });

So as you can seeautorefreshtoken is set to true

To Reproduce

build up a basic connection using the code above and try to make a basic query after some time.

Expected behavior

The token should be autorenewed and every query should run fine, even after some time

System information

  • OS: Windows 10
  • Browser Not browser, React Native: 0.73.6, Expo: 50.0.17
  • Version of supabase-js: 2.43.0
  • Version of Node.js: 20.10.0

Add any other context about the problem here.
Ik. There were simlilar problems somehow solved, but its not about somehow tricking the code into wirking, but to make it work properly as it should. And yes. None of the suggested solutions worked for me.

@dikovmaxim dikovmaxim added the bug Something isn't working label May 15, 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
Projects
None yet
Development

No branches or pull requests

1 participant