init auth
This commit is contained in:
parent
4fd1bdfd62
commit
f54f6f2aa9
8 changed files with 662 additions and 21 deletions
pages/api/auth
25
pages/api/auth/[...nextauth].ts
Normal file
25
pages/api/auth/[...nextauth].ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import NextAuth from "next-auth/next";
|
||||
import TwitchProvider from "next-auth/providers/twitch";
|
||||
import {
|
||||
MongoDBAdapter,
|
||||
MongoDBAdapterOptions,
|
||||
} from "@next-auth/mongodb-adapter";
|
||||
import clientPromise from "../../../lib/mongodb";
|
||||
|
||||
export const dbOptions: MongoDBAdapterOptions = {
|
||||
collections: {
|
||||
Users: "web_users",
|
||||
Accounts: "web_accounts",
|
||||
Sessions: "web_sessions",
|
||||
},
|
||||
};
|
||||
|
||||
export default NextAuth({
|
||||
adapter: MongoDBAdapter(clientPromise, dbOptions),
|
||||
providers: [
|
||||
TwitchProvider({
|
||||
clientId: process.env.TWITCH_CLIENT_ID ?? "",
|
||||
clientSecret: process.env.TWITCH_SECRET ?? "",
|
||||
}),
|
||||
],
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue