-
-
Notifications
You must be signed in to change notification settings - Fork 181
Not possible to keep user signed in #323
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
Comments
Hey @nereolopez - just a quick check: what platform/framework are you using? |
Hey @kiwicopple , thanks for your message. We are using Angular's latest version and Supabase directly |
Hi @kiwicopple, just wanted to check if there is any progress on this? I personally don't know where the issue is coming from, but if somehow we could support or contribute, we can try with some guidance. Thanks! |
This one is getting worked on over here! #274 |
Great news! I will keep an eye on it and test it as soon it is available, both in the browser and in Android/iOS installed as a PWA. Thanks! |
Hi @kiwicopple, we noticed something additional (not sure if related, but in case it gives any hint). When opening the App (be it on the browser or on the phone as a PWA) we are automatically redirected to the Sign in page. This is because the Angular guard that checks that route makes the user stay in the Sign In page if there is no It is a strange behavior and can't see why, but hope the info is helpful. Thanks |
@nereolopez this sounds like the issue I tried to solve with #265, but I have not received any feedback on the PR so far. |
@nereolopez @lebrinkma we are also encountering the same challenge (React Native app on iOS) and my understanding from the comment here was that it's likely due to our use of AsyncStorage. between the token expiring from background + user being null on first load, it's been a bit difficult to ensure we're using the correct user auth. would love to see a solution like #265 go out! |
@anngbaum @lebrinkma, apologies for my delay, business trips are keeping me busy. Interesting the comment you linked, most likely it is scenario 3 which we are facing. The proposed solution supabase/gotrue-js#265 looks good. The only point I see is that then we have Also, I see that supabase/gotrue-js#274 that @kiwicopple mentioned is already closed. Is this available now if we update supabase-js version? Does it fix the problem we are describing? Thanks to all! |
Quick update. I just tried by updating to the latest version in case changes were already there, and still face the same. Angular Guard is redirecting the user to the home page because Is there any workaround in the meantime that could be taken? |
this was a helpful comment illustrating the delay, which I agree is still a problem for us as well. the workaround that we're using is a listener onAuthStateChange which does successfully fire once the token is refreshed, and then using that to update the UI so that the user is taken directly into the application. It does cause an unfortunate flicker in the UI which is suboptimal, but at least prevents having to re-log in. I asked a somewhat similar question in the #gotrue discord here but have not heard anything further, will let you know if that generates any responses though! |
Hey team, Thanks for your patience -- we haven't forgotten about this issue and we'll be transferring this to the auth repo so we can best track this. |
Hey @anngbaum, We're aiming to get v2 out next month! 🤞🏻 |
https://supabase.com/blog/supabase-js-v2
Should be good to go here now, right? |
Hi @ARMATAV, that would be good news. Please allow us few days to test it and revert :) |
@ARMATAV we've been testing with RC3 both on web and installed on phones as PWA in different scenarios and in all the cases the session kept open, first calls to backend after wake up of the app succeeded, so for now, not able to reproduce the issue 🥳. Please feel free to close it and thanks again for the fix and support! |
@nereolopez Ah, now it finally is the best auth experience available. Hopefully they fix the I'm not actually a repo contributor my dude - so I can't close the issue - but, hey, good that it works though! |
Sorry @ARMATAV, I am in the middle of my first paternity leave and went straight to test it. As you left the note I did not check and just assumed you were. I am closing the issue then. Thanks! |
@nereolopez Congratulations on the kid! |
Bug report
Describe the bug
The issues is that the user gets kicked off the app and needs to sign in again over and over.
After checking the many threads on this issue, these are the two scenarios we face:
The token gets refreshed when I come back to the application after 1 hour which is the default expiration time (see screenshot below where the event is captured), but the immediate next call (and all subsequent ones) fail with the error message "JWT expired"

If I take way longer to come back to the application, the token does not get refreshed an the next request fails with a "invalid_grant Invalid Refresh Token" error.
To Reproduce
The project is using supabase-js and Angular installed as PWA
SupabaseClient
withautoRefreshToken
set totrue
.supabase.auth.signIn({ email: email, password: password });
Expected behavior
We are porting from Firebase to Supabase, and our understanding was that the
autoRefreshToken
should help achieving keeping the user signed in.There are some other threads where it is proposed to check the result of every call, and if the error is "JWT expired" then try to sign in the user again in the background and retry the original call, but that would be a workaround more than the solution.
System information
Additional context
Just to say that we are loving Supabase. It would be great to be able to keep our users signed in automatically, otherwise it will be hard to deploy the version backed by Supabase rather than Firebase. Thanks!
The text was updated successfully, but these errors were encountered: