feat: add credentials authentication (#1)

This commit is contained in:
Meier Lukas
2023-12-10 17:12:20 +01:00
committed by GitHub
parent 41e54d940b
commit 3cedb7fba5
53 changed files with 890 additions and 2105 deletions

View File

@@ -1,3 +1,14 @@
export { GET, POST } from "@alparr/auth";
import type { NextRequest } from "next/server";
export const runtime = "edge";
import { createHandlers } from "@alparr/auth";
export const GET = async (req: NextRequest) => {
return await createHandlers(isCredentialsRequest(req)).handlers.GET(req);
};
export const POST = async (req: NextRequest) => {
return await createHandlers(isCredentialsRequest(req)).handlers.POST(req);
};
const isCredentialsRequest = (req: NextRequest) => {
return req.url.includes("credentials") && req.method === "POST";
};

View File

@@ -3,8 +3,6 @@ import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
import { appRouter, createTRPCContext } from "@alparr/api";
import { auth } from "@alparr/auth";
export const runtime = "edge";
/**
* Configure basic CORS headers
* You should extend this to match your needs