chore(debug): next-auth url

This commit is contained in:
Michael Zetterberg
2024-04-28 10:32:22 +02:00
parent 8e05f03f16
commit b377317e07

View File

@@ -1,3 +1,5 @@
import { createActionURL } from "@auth/core"
import { headers as nextHeaders } from "next/headers"
import { NextRequest, NextResponse } from "next/server"
import { AuthError } from "next-auth"
@@ -35,6 +37,7 @@ export async function GET(
request.headers.get("host") ??
env.URL
redirectTo = `${proto}://${host}/`
console.log({ login_fallback: redirectTo })
}
// Clean up cookie from authRequired middleware
@@ -87,6 +90,17 @@ export async function GET(
console.log({ login_AUTH_URL: process.env.AUTH_URL })
console.log({ login_NEXTAUTH_URL: process.env.NEXTAUTH_URL })
console.log({ login_env: process.env })
const headers = new Headers(nextHeaders())
const signInURL = createActionURL(
"signin",
// @ts-expect-error `x-forwarded-proto` is not nullable, next.js sets it by default
headers.get("x-forwarded-proto"),
headers,
process.env
)
console.log({ login_signInURL: signInURL })
const redirectUrl = await signIn(
"curity",
{