-
Notifications
You must be signed in to change notification settings - Fork 132
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
Auth Refresh tokens not propagating throughout app. #137
Comments
Related: #127 |
I am able to replicate, I see the same behavior in my project. Using |
I came here to open an issue for this exact same problem. When the token gets refreshed, all requests to the supabase client still use the old token. It can be fixed by removing the authorization header in
The underlying supabase-js client maintains this header on its own and uses the one from refreshed sessions correctly. |
@optinforce I don't follow your solution. I have tried catching this error and refreshing the session....
....but this does not work. Can I go into this options object and remove the Authorization header somehow? |
FWIW, I have resolved this in my setup by:-
to this...
|
Version
@nuxtjs/supabase: v0.3.0
nuxt: v3.0.0
Steps to reproduce
session expiry limit
on Supabase GUI to be 60 seconds (so you don't have to wait an hour each time)automatic reuse detection
too in order to simplify the demoonAuthStateChanged
function to a top level component or page and console log the event and sessionWhat is Expected?
The json response of the Supabase request should be displayed on the webpage each time you press the button.
After 60 seconds the
onAuthStateChanged
function will trigger and show us our new request token.What is actually happening?
The json reponse is being displayed, then after pressing the button and waiting 60 seconds the request to supabase returns
{"code":"PGRST301","details":null,"hint":null,"message":"JWT expired"}
.After some debugging I can see that the request is still using the original auth header and not the one generated using the refresh token. I believe this could be an issue with the Supabase client not being recreated correctly with the newly generated token.
I have also notice that the newly created token is being stored in a cookie each time as expected but the client does not seem to notice the change.
Refreshing the webpage fixes the issue and the requests to Supabase work again for another 60 seconds.
The text was updated successfully, but these errors were encountered: