mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-09-09 11:15:08 +08:00
Adding a basic version of next-auth-js using Discord and ensuring an authenticated user can fetch prompts from the real backend using an API middlelayer
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import NextAuth from "next-auth";
|
||||
import DiscordProvider from "next-auth/providers/discord";
|
||||
|
||||
export const authOptions = {
|
||||
providers: [
|
||||
DiscordProvider({
|
||||
clientId: process.env.DISCORD_CLIENT_ID,
|
||||
clientSecret: process.env.DISCORD_CLIENT_SECRET,
|
||||
}),
|
||||
],
|
||||
callbacks: {
|
||||
async session({ session, token, user }) {
|
||||
session.user.sub = token.sub;
|
||||
return session;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default NextAuth(authOptions);
|
||||
Reference in New Issue
Block a user