-
-
Notifications
You must be signed in to change notification settings - Fork 296
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
Breaking changes: OAuth session token deleted from Cookies on page refresh after updating to 2.47.6 #1334
Comments
The same with |
Running into similar issues with cookies, randomly disappear after upgrading to 2.47.6. |
Same issues as above in a Next app router using
|
Using Next App Router with boilerplate Next.js SSR setup from Supabase docs and sb cookies are no longer created or are disappearing during authentication. Version |
Seeing the same issue |
I'm not going crazy then. Noticed about an hour after the release but thought I must be missing something since there was no issue here for it. Had to pin to a few versions ago to get it working again. An insidious one if you have the ^ in your package.json, everything works locally (until you do an npm install of course) but then deploying the app to production installs the most recent version and so this pretty serious auth bug is in your app. I had |
I have been pulling my hair out ALL day on this, I dug into the logs and I see this now:
I've tried even disabling PKCE flow and detect from URL. No matter what it is defaulted to true and it checks this pathway first and only. Specifically this code from auth-js /**
* IMPORTANT:
* 1. Never throw in this method, as it is called from the constructor
* 2. Never return a session from this method as it would be cached over
* the whole lifetime of the client
*/
private async _initialize(): Promise<InitializeResult> {
try {
if (isBrowser() && this.detectSessionInUrl) {
const { data, error } = await this._getSessionFromURL()
if (error) {
this._debug('#_initialize()', 'error detecting session from URL', error)
if (isAuthImplicitGrantRedirectError(error)) {
const errorCode = error.details?.code
if (
errorCode === 'identity_already_exists' ||
errorCode === 'identity_not_found' ||
errorCode === 'single_identity_not_deletable'
) {
return { error }
}
}
// failed login attempt via url,
// remove old session as in verifyOtp, signUp and signInWith*
await this._removeSession()
return { error }
} From what I can see this.detectSessionInUrl is ALLLLWAYS set and so it tries the PKCE flow // Checks for mismatches between the flowType initialised in the client and the URL parameters
if (!isRedirectFromImplicitGrantFlow && !isRedirectFromPKCEFlow) {
if (this.flowType === 'implicit') {
throw new AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')
} else if (this.flowType === 'pkce') {
throw new AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.')
} else {
throw new AuthError('Invalid flow type.')
}
} supabase/auth-js@089c687 It's somewhere in one of those two commits but I'm not familiar enough with the codebase. It's never able to detect that it's an implicit flow and those two commits dropped recently. I was able to make it work in my testing by debugging and rewriting variables on the fly such that it would bypass the PKCE check. Then auth worked as normal. |
OMG thank goodness I almost deleted ALL of my work today building a REST proxy because I thought I broke this :/ Downgrading to 2.45.4 D: |
I just wasted my evening debugging this... 🤦 Traced it down to the same lines above with this errors:
This fixed it for me. export const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey, {
auth: {
detectSessionInUrl: false,
},
}); |
2.47.5 is the latest safest version, staying locked here til this is fixed Lol RIP |
I'm very upset with myself... I had a feeling it was just a "fresh release" issue about an hour ago and tried to downgrade, but forgot to remove the |
If Supabase team ever seeeees this where are the rate limiting options for Realtime that were promised months ago, or ways to disable public from spamming messages with anon key.. wassup. I was told it was a PR in review to go to dashboard a long time ago |
lost hours debugging and logging this bug 🤦🏻♂️ downgraded |
Uff cost me an evening and a morning.. Reverted to 2.47.5, then found this issue report 🙃 |
…version pin supabase-js version to avoid supabase/supabase-js#1334
""””” |
Bug report
Describe the bug
When using
@supabase/supabase-js
with Twitch as an OAuth provider, the auth-token is saved to localStorage upon redirection, but is immediately removed after a page refresh. This issue occurs after upgrading @supabase/supabase-js from2.47.5
to2.47.6
: #1334 (comment).So i guess the culprit is here : https://github.com/supabase/auth-js/releases/tag/v2.67.0
After twitch login redirection, we get a session, which is stored in localStorage. At this point it's the expected behaviour.
But after a single page refresh, or a route redirection, the token is deleted from localStorage, the user is not authenticated, and the session does not persist. This behavior breaks the login flow, which worked correctly in previous versions.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
This works with
2.47.5
but not with2.47.6
:useSupabase.ts composable :
/pages/auth/redirect.vue :
/pages/a_vue_page.vue :
Expected behavior
After redirection, the session token should remain in localStorage and the user should stay authenticated.
System information
The text was updated successfully, but these errors were encountered: