OAuth sign in isn't redirecting on the server side
The reason behind this limitation is that the auth helpers library lacks a direct mechanism for performing server-side redirects, as each framework handles redirects differently. However, the library does offer a URL through the data property it returns, which should be used for the purpose of redirection.
With the PKCE flow in @supabase/ssr, signInWithOAuth stores the code verifier in a cookie. When your setAll collects Set-Cookie headers into a Headers object, as in Remix, pass them on the redirect. Otherwise the browser never stores the code verifier and the callback exchange fails. In Next.js and SvelteKit, the framework's cookie API writes to the response for you, so the redirect needs nothing extra.
Next.js:
import { NextResponse } from "next/server";...const { data } = await supabase.auth.signInWithOAuth({ provider: 'github',})return NextResponse.redirect(data.url)SvelteKit:
import { redirect } from '@sveltejs/kit';...const { data } = await supabase.auth.signInWithOAuth({ provider: 'github',})throw redirect(303, data.url)Remix:
import { redirect } from "@remix-run/node"; // or cloudflare/deno// Your server client factory: createServerClient with a setAll that appends// Set-Cookie to `headers`, returning both. See the PKCE flow's Server example.import { createClient } from "~/lib/supabase.server";...const { supabase, headers } = createClient(request)const { data } = await supabase.auth.signInWithOAuth({ provider: 'github',})return redirect(data.url, { headers })