Update oauth-with-pkce-flow-for-ssr.mdx (#20071)

I moved the headers declaration outside of the if statement code block, as in the example, we are required to provide these headers to the redirect if the code fails.
This commit is contained in:
Callum Kloos authored and GitHub committed 2024-01-02 13:57:21 +00:00
1 parent 4bca7baf15
commit 67a840915d
1 file changed
+1 -2
@@ -156,11 +156,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
const requestUrl = new URL(request.url)
const code = requestUrl.searchParams.get('code')
const next = requestUrl.searchParams.get('next') || '/'
const headers = new Headers()
if (code) {
const cookies = parse(request.headers.get('Cookie') ?? '')
const headers = new Headers()
const supabase = createServerClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!, {
cookies: {
get(key) {