feat: add credentials authentication (#1)
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* @see https://github.com/nextauthjs/next-auth/pull/8932 */
|
||||
|
||||
import Discord from "@auth/core/providers/discord";
|
||||
import type { DefaultSession } from "@auth/core/types";
|
||||
import { DrizzleAdapter } from "@auth/drizzle-adapter";
|
||||
import NextAuth from "next-auth";
|
||||
|
||||
import { db, tableCreator } from "@alparr/db";
|
||||
import { createConfiguration } from "./configuration";
|
||||
|
||||
export type { Session } from "next-auth";
|
||||
|
||||
@@ -18,21 +12,8 @@ declare module "next-auth" {
|
||||
}
|
||||
}
|
||||
|
||||
export const {
|
||||
handlers: { GET, POST },
|
||||
auth,
|
||||
signIn,
|
||||
signOut,
|
||||
} = NextAuth({
|
||||
adapter: DrizzleAdapter(db, tableCreator),
|
||||
providers: [Discord],
|
||||
callbacks: {
|
||||
session: ({ session, user }) => ({
|
||||
...session,
|
||||
user: {
|
||||
...session.user,
|
||||
id: user.id,
|
||||
},
|
||||
}),
|
||||
},
|
||||
});
|
||||
export * from "./security";
|
||||
|
||||
export const createHandlers = (isCredentialsRequest: boolean) =>
|
||||
createConfiguration(isCredentialsRequest);
|
||||
export const { auth } = createConfiguration(false);
|
||||
|
||||
Reference in New Issue
Block a user