mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
30 lines
955 B
JavaScript
30 lines
955 B
JavaScript
import NextAuth from 'next-auth';
|
|
import Providers from 'next-auth/providers';
|
|
|
|
export const authOptions = {
|
|
providers: [
|
|
Providers.GitHub({
|
|
clientId: process.env.GITHUB_CLIENT_ID,
|
|
clientSecret: process.env.GITHUB_CLIENT_SECRET,
|
|
}),
|
|
// Add other providers here (e.g., Google, Email, etc.)
|
|
],
|
|
secret: process.env.NEXTAUTH_SECRET, // Ensure this is set in your .env file
|
|
callbacks: {
|
|
async session(session, user) {
|
|
// Add custom session properties if needed
|
|
session.user.id = user.id;
|
|
session.user.role = user.role; // Example: Add role to session
|
|
return session;
|
|
},
|
|
async jwt(token, user) {
|
|
if (user) {
|
|
token.id = user.id;
|
|
token.role = user.role; // Example: Add role to token
|
|
}
|
|
return token;
|
|
},
|
|
},
|
|
};
|
|
|
|
export default NextAuth(authOptions); |