supabase
supabase copied to clipboard
onAuthStateChange only fires "INITIAL_SESSION" event?
Hello I'm not sure what I'm doing wrong because this setup worked on another project a bit ago but onAuthStateChange does not fire besides the initial session event. I believe I am successfully logging in with google OAuth because it does redirect me back to localhost and if I read the session data I have my tokens and basic google account info. Sign in only fires if I am signed in and then I switch tabs and back to it, but not when I actually log in. This is all inside a userStore using pinia and the userStore is always on the page. Any idea what I'm doing wrong?
const supabase = useSupabaseClient()
// use google oAuth
async function handleLogin() {
await supabase.auth.signInWithOAuth({
provider: 'google',
})
}
supabase.auth.onAuthStateChange(async (event, session) => {
console.log('event', event)
switch (event) {
case "INITIAL_SESSION":
console.log("Initial session", session)
break
case 'SIGNED_IN':
console.log('User signed in');
await handleSignInEvent()
break;
}
});
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
same problem here. Did you find any fix for the issue? It is me or is Supabase becoming very unstable lately?