diff --git a/src/app/(dynamic-pages)/(login-pages)/auth/callback/route.ts b/src/app/(dynamic-pages)/(login-pages)/auth/callback/route.ts index d091374b..9c698a2f 100644 --- a/src/app/(dynamic-pages)/(login-pages)/auth/callback/route.ts +++ b/src/app/(dynamic-pages)/(login-pages)/auth/callback/route.ts @@ -22,30 +22,26 @@ export async function GET(request: Request) { } } - if (provider) { - // HACK_ALERT!!! - // cookie is probably set on 'next.digger.dev' we have to change it to `.digger.dev` - const cookieKey = `sb-${process.env.SUPABASE_PROJECT_REF}-auth-token`; - const cookieStore = cookies(); - const currentCookieValue = cookieStore.get(cookieKey)?.value; - // get domain of current reques - const domain = new URL(request.url).hostname; - if ( - domain.includes('next.digger.dev') && - currentCookieValue && - !isDevelopment - ) { - // delete cookie from next.digger.dev - cookieStore.delete(cookieKey); - // set cookie to .digger.dev - cookieStore.set(cookieKey, currentCookieValue, { - domain: '.digger.dev', - secure: true, - path: '/', - sameSite: 'lax', - httpOnly: true, - }); - } + // HACK_ALERT!!! + // cookie is probably set on 'next.digger.dev' we have to change it to `.digger.dev` + const cookieKey = `sb-${process.env.SUPABASE_PROJECT_REF}-auth-token`; + const cookieStore = cookies(); + const currentCookieValue = cookieStore.get(cookieKey)?.value; + // get domain of current reques + const domain = new URL(request.url).hostname; + if ( + domain.includes('next.digger.dev') && + currentCookieValue && + !isDevelopment + ) { + // set cookie to .digger.dev + cookieStore.set(cookieKey, currentCookieValue, { + domain: '.digger.dev', + secure: true, + path: '/', + sameSite: 'lax', + httpOnly: true, + }); } let redirectTo = new URL('/dashboard', requestUrl.origin);