-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathroute.ts
More file actions
34 lines (32 loc) · 737 Bytes
/
route.ts
File metadata and controls
34 lines (32 loc) · 737 Bytes
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
27
28
29
30
31
32
33
34
import NextAuth from "next-auth";
import GoogleProvider from "next-auth/providers/google";
const handler = NextAuth({
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
authorization: {
params: {
prompt: "consent",
access_type: "offline",
response_type: "code"
}
}
}),
],
pages: {
signIn: "/auth/signin",
},
callbacks: {
async session({ session, token }) {
return session;
},
async jwt({ token, user }) {
if (user) {
token.id = user.id;
}
return token;
},
},
});
export { handler as GET, handler as POST };