fix(github-oauth): use NEXTAUTH_URL for redirect_uri instead of req.url.origin
Behind Coolify's proxy, req.url resolves to 0.0.0.0:3000 which GitHub rejects as an unregistered redirect URI. Prefer NEXTAUTH_URL env var. Made-with: Cursor
This commit is contained in:
@@ -32,7 +32,7 @@ function bounce(origin: string, returnTo: string, params: Record<string, string>
|
||||
|
||||
export async function GET(req: Request) {
|
||||
const url = new URL(req.url);
|
||||
const origin = url.origin;
|
||||
const origin = (process.env.NEXTAUTH_URL ?? url.origin).replace(/\/$/, "");
|
||||
|
||||
// Recover the original target from the state cookie *before* any error path.
|
||||
const cookieState = req.headers.get("cookie")
|
||||
|
||||
Reference in New Issue
Block a user