import { redirect } from "@remix-run/node"; | |
import type { LoaderFunctionArgs } from "@remix-run/node"; | |
import { githubApp } from "~/lib/github-app.server"; | |
export async function loader({ request }: LoaderFunctionArgs) { | |
const url = new URL(request.url); | |
const state = url.searchParams.get("state") || crypto.randomUUID(); | |
// Generate OAuth URL for user identity authorization | |
const oauthUrl = githubApp.getOAuthUrl(state); | |
return redirect(oauthUrl); | |
} | |