forked from Pudi-Sravan/digital_fortress_frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.ts
26 lines (24 loc) · 758 Bytes
/
auth.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import NextAuth from "next-auth"
import authConfig from "./auth.config"
export const { handlers, auth, signIn, signOut } = NextAuth({
session: { strategy: "jwt" },
...authConfig,
debug: process.env.NODE_ENV === 'development',
callbacks: {
async jwt({ token, trigger, session, account }) {
if (account?.provider === "google") {
token.accessToken = account.access_token;
}
return token;
},
async session({ session, token}) {
session.accessToken = token.accessToken as string ;
session.user = token.user as any ;
return session
}
},
secret: process.env.AUTH_SECRET,
pages:{
signIn: '/',
},
})