Spaces:
Sleeping
Sleeping
update
Browse files123456789101112131415161718192021222324252627import { 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://"}` +host +"/auth/callback";const loginRedirectUrl = `https://huggingface.co/oauth/authorize?client_id=${process.env.OAUTH_CLIENT_ID}&redirect_uri=${redirect_uri}&response_type=code&scope=openid%20profile%20write-repos%20manage-repos%20inference-api&prompt=consent&state=1234567890`;return NextResponse.json({redirect: loginRedirectUrl,},{status: 200,headers: {"Content-Type": "application/json",},});}export async function POST(req: NextRequest) {const body = await req.json();const { code } = body;12345import { NextRequest, NextResponse } from "next/server";export async function POST(req: NextRequest) {const body = await req.json();const { code } = body;
app/api/auth/route.ts-22