diff --git a/packages/common/gotrue.ts b/packages/common/gotrue.ts index e7aca65bf29..295ce8fa2fd 100644 --- a/packages/common/gotrue.ts +++ b/packages/common/gotrue.ts @@ -21,6 +21,10 @@ const shouldEnableNavigatorLock = process.env.NEXT_PUBLIC_IS_PLATFORM === 'true' && !(globalThis?.localStorage?.getItem(AUTH_NAVIGATOR_LOCK_DISABLED_KEY) === 'true') +const shouldDetectSessionInUrl = process.env.NEXT_PUBLIC_AUTH_DETECT_SESSION_IN_URL + ? process.env.NEXT_PUBLIC_AUTH_DETECT_SESSION_IN_URL === 'true' + : true + const navigatorLockEnabled = !!(shouldEnableNavigatorLock && globalThis?.navigator?.locks) if (shouldEnableNavigatorLock && !globalThis?.navigator?.locks) { @@ -103,7 +107,7 @@ const logIndexedDB = (message: string, ...args: any[]) => { export const gotrueClient = new AuthClient({ url: process.env.NEXT_PUBLIC_GOTRUE_URL, storageKey: STORAGE_KEY, - detectSessionInUrl: true, + detectSessionInUrl: shouldDetectSessionInUrl, debug: debug ? (persistedDebug ? logIndexedDB : true) : false, lock: navigatorLockEnabled ? navigatorLock : undefined, })