You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Bug report
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
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.
The text was updated successfully, but these errors were encountered: