Files
Homarr/packages/auth/index.ts

27 lines
864 B
TypeScript
Raw Normal View History

import { headers } from "next/headers";
import type { DefaultSession } from "@auth/core/types";
2023-12-08 22:35:15 +01:00
import type { ColorScheme, GroupPermissionKey, SupportedAuthProvider } from "@homarr/definitions";
import { createConfiguration } from "./configuration";
2023-12-08 22:35:15 +01:00
export type { Session } from "next-auth";
2023-12-08 22:35:15 +01:00
declare module "next-auth" {
2023-12-08 22:35:15 +01:00
interface Session {
user: {
id: string;
permissions: GroupPermissionKey[];
colorScheme: ColorScheme;
2023-12-08 22:35:15 +01:00
} & DefaultSession["user"];
}
}
export * from "./security";
// See why it's unknown in the [...nextauth]/route.ts file
export const createHandlersAsync = async (provider: SupportedAuthProvider | "unknown", useSecureCookies: boolean) =>
createConfiguration(provider, await headers(), useSecureCookies);
export { getSessionFromTokenAsync as getSessionFromToken, sessionTokenCookieName } from "./session";