Spaces:
Sleeping
Sleeping
Download src/app/api/auth/github/route.ts from CosmicMagnetar/opentriage-api: direct link, hf CLI and curl.
- Browser
- Download file 576 Bytes
-
https://huggingface.co/spaces/CosmicMagnetar/opentriage-api/resolve/main/src/app/api/auth/github/route.ts
- Command line
-
hf download hf://spaces/CosmicMagnetar/opentriage-api/src/app/api/auth/github/route.ts
-
curl -L -o route.ts https://huggingface.co/spaces/CosmicMagnetar/opentriage-api/resolve/main/src/app/api/auth/github/route.ts
576 Bytes
| import { NextRequest, NextResponse } from "next/server"; | |
| const GITHUB_CLIENT_ID = process.env.GITHUB_CLIENT_ID!; | |
| const API_URL = process.env.API_URL || "http://localhost:3000"; | |
| /** | |
| * GET /api/auth/github | |
| * Redirect to GitHub OAuth authorization page. | |
| */ | |
| export async function GET(request: NextRequest) { | |
| const callbackUrl = `${API_URL}/api/auth/github/callback`; | |
| const githubUrl = `https://github.com/login/oauth/authorize?client_id=${GITHUB_CLIENT_ID}&redirect_uri=${callbackUrl}&scope=user:email,read:user,repo`; | |
| return NextResponse.redirect(githubUrl); | |
| } | |