fix auth
Browse filesFiles changed (3)
12345678910import { NextRequest, NextResponse } from "next/server";export async function GET(req: NextRequest) {const host =req.headers.get("x-current-host") ??req.headers.get("host") ??"localhost:3000";const redirect_uri =`${host.includes("localhost") ? "http://" : "https://"}` +1234567import { NextRequest, NextResponse } from "next/server";export async function GET(req: NextRequest) {const host = req.headers.get("host") ?? "localhost:3000";const redirect_uri =`${host.includes("localhost") ? "http://" : "https://"}` +
123456789101112131415161718import { redirect } from "next/navigation";import { Metadata } from "next";import { headers } from "next/headers";import { apiServer } from "@/lib/api";async function getLoginUrl() {const headersList = await headers();const pathname = headersList.get("x-current-host") || "/";try {const res = await apiServer.get("/auth", {headers: {"x-current-host": pathname,},});return res.data;} catch (error) {return error;1234567891011import { redirect } from "next/navigation";import { Metadata } from "next";import { apiServer } from "@/lib/api";async function getLoginUrl() {try {const res = await apiServer.get("/auth");return res.data;} catch (error) {return error;
2 unmodified lines3456782 unmodified linesexport function middleware(request: NextRequest) {const headers = new Headers(request.headers);headers.set("x-current-host", request.nextUrl.host);return NextResponse.next({ headers });}2 unmodified lines34567892 unmodified linesexport function middleware(request: NextRequest) {const headers = new Headers(request.headers);console.log("Middleware Headers:", request.nextUrl);headers.set("x-current-host", request.nextUrl.host);return NextResponse.next({ headers });}
app/api/auth/route.ts+1-4
app/auth/page.tsx+1-8
middleware.ts+1