mirror of
https://github.com/SrIzan10/echospace.git
synced 2026-06-06 00:56:54 +00:00
19 lines
466 B
TypeScript
19 lines
466 B
TypeScript
import { generateState } from "arctic";
|
|
import { github } from "@/lib/auth";
|
|
import { cookies } from "next/headers";
|
|
|
|
export async function GET(): Promise<Response> {
|
|
const state = generateState();
|
|
const url = github.createAuthorizationURL(state, []);
|
|
|
|
(await cookies()).set("github_oauth_state", state, {
|
|
path: "/",
|
|
secure: process.env.NODE_ENV === "production",
|
|
httpOnly: true,
|
|
maxAge: 60 * 10,
|
|
sameSite: "lax"
|
|
});
|
|
|
|
return Response.redirect(url);
|
|
}
|