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
Is your feature request related to a problem? Please describe.
If the auth token expires and the user navigates to the web app, then for half a second the public routes are shown (while the auth token is refreshed) and then the private routes are being shown.
The problem is that there is no way to track when a new token is fetches, so that I can show, for example, a loader.
This leads to bad UX and the users thinks they are logged out, but after half a second they are logged in again.
I know you can check the supabase.auth.session() to see if the users is logged in but this won't help as you only get null or a value and it is not actually a promise on which you can wait.
Describe the solution you'd like
Maybe emit an event in onAuthStateChange, like REFRESHING_TOKEN so the UI can show something relevant.
The text was updated successfully, but these errors were encountered:
#285 introduces async getSession() and async getUser(). This PR has been merged and published to npm @next.
constinitializeSupabase=async()=>{constsupabase=createClient(...);const{ error, session }=awaitsupabase.auth.getSession();// if session === null at this point you can be sure the // user is not logged in otherwise the user is logged in}
If you like to beta test gotrue-js @next you can use it like this:
add "@supabase/gotrue-js": "next", to dependencies in package.json
add a new overrides node to the root of your package.json
Feature request
Is your feature request related to a problem? Please describe.
If the auth token expires and the user navigates to the web app, then for half a second the public routes are shown (while the auth token is refreshed) and then the private routes are being shown.
The problem is that there is no way to track when a new token is fetches, so that I can show, for example, a loader.
This leads to bad UX and the users thinks they are logged out, but after half a second they are logged in again.
I know you can check the
supabase.auth.session()
to see if the users is logged in but this won't help as you only get null or a value and it is not actually a promise on which you can wait.Describe the solution you'd like
Maybe emit an event in
onAuthStateChange
, likeREFRESHING_TOKEN
so the UI can show something relevant.The text was updated successfully, but these errors were encountered: