|
I'm picking up the code setup by a recently offboarded member of our team. He set up all the supabase code and I'm here to maintain it. Problem: I have noticed when using google or regular sign in, after 1 hour, I get logged out and see the following message in my client console: I need to manually go to the login page and click on the google login option to continue using the application. Given my limited understanding, the expected behavior using supabase is that after my 1 hour access token expires, my refresh token should fetch a new bundle of access and refresh tokens from supabase and this should automatically keep my session up and running. Is this true? If so, then what could be the reason for my sessions ending after my access token expires? Please let me know if there is any code I need to share (like the middleware.ts, or any of the supabase/actions.ts /client.ts /middleware.ts or /server.ts |
Replies: 3 comments 8 replies
|
Your assumption is correct. Supabase-js clients will refresh the access token (jwt) before it expires with a timer. They also store the tokens in local storage and when the app starts up will refresh the token behind the scenes (can take awhile so you have to await getSession). That is all browser stuff. If you have server code also involved then you have to use something like auth-helpers/SSR to use a cookie to keep all the different clients refreshed or take care of it yourself. |
|
Are you using Supabase on the server-side? If so, I'd highly recommend the ssr package. |
This was the solution to my problem