supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

Breaking change, session null `onAuthStateChange`

Open cmcnicholas opened this issue 11 months ago • 1 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

After upgrading to latest library version 2.47.6 from 2.47.5 I am being logged out of my application due to a null session.

To Reproduce

We use the following to map auth session values to a reactive value. I've never before experienced null sessions when logged in.

    // listen to auth state changes
    client.auth.onAuthStateChange((event, session) => {
      if (session === null) {
        window.location.href = createRedirectUrl('unauthenticated_state', window.location.href);
      } else {
        authSession.value = session;
      }
    });

Expected behavior

null session shouldn't be reported as the session is valid (prior call to GetSession() confirms this.

cmcnicholas avatar Dec 13 '24 16:12 cmcnicholas