Add Support & Social module to dashboard sidebar
This commit is contained in:
29
src/app/api/auth/[...nextauth]/route.ts
Normal file
29
src/app/api/auth/[...nextauth]/route.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import NextAuth from "next-auth"
|
||||
import TwitchProvider from "next-auth/providers/twitch"
|
||||
|
||||
const handler = NextAuth({
|
||||
providers: [
|
||||
TwitchProvider({
|
||||
clientId: process.env.TWITCH_CLIENT_ID!,
|
||||
clientSecret: process.env.TWITCH_CLIENT_SECRET!,
|
||||
}),
|
||||
],
|
||||
callbacks: {
|
||||
async session({ session, token }) {
|
||||
if (session?.user) {
|
||||
// Pass the user ID to the session
|
||||
// Note: We might need to extend the type definition for session.user
|
||||
(session.user as any).id = token.sub;
|
||||
}
|
||||
return session;
|
||||
},
|
||||
async jwt({ token, user }) {
|
||||
if (user) {
|
||||
token.id = user.id;
|
||||
}
|
||||
return token;
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export { handler as GET, handler as POST }
|
||||
Reference in New Issue
Block a user