diff options
Diffstat (limited to '')
| -rw-r--r-- | packages/web/server/auth.ts (renamed from packages/web/lib/auth.ts) | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/packages/web/lib/auth.ts b/packages/web/server/auth.ts index df98e6b8..05d3d296 100644 --- a/packages/web/lib/auth.ts +++ b/packages/web/server/auth.ts @@ -1,8 +1,20 @@ -import NextAuth, { NextAuthOptions } from "next-auth"; +import NextAuth, { NextAuthOptions, getServerSession } from "next-auth"; import { PrismaAdapter } from "@next-auth/prisma-adapter"; import AuthentikProvider from "next-auth/providers/authentik"; -import serverConfig from "@/lib/config"; -import prisma from "@remember/db"; +import serverConfig from "@/server/config"; +import { prisma } from "@remember/db"; +import { DefaultSession } from "next-auth"; + +declare module "next-auth" { + /** + * Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context + */ + export interface Session { + user: { + id: string; + } & DefaultSession["user"]; + } +} const providers = []; @@ -23,3 +35,5 @@ export const authOptions: NextAuthOptions = { }; export const authHandler = NextAuth(authOptions); + +export const getServerAuthSession = () => getServerSession(authOptions); |
