-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.ts
37 lines (35 loc) · 941 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
27
28
29
30
31
32
33
34
35
36
37
import NextAuth, { NextAuthConfig } from "next-auth";
import Google from "next-auth/providers/google";
/*
* In order to log in through your browser and expose the logged in state
* to the Plasmic studio you would need to additionally configure cookies.
* This is only needed in development mode, in production mode these
* policies need to be disabled for security reasons.
**/
const devCookiesConfig: NextAuthConfig["cookies"] = {
sessionToken: {
options: {
httpOnly: true,
sameSite: "none",
secure: true,
},
},
callbackUrl: {
options: {
httpOnly: true,
sameSite: "none",
secure: true,
},
},
csrfToken: {
options: {
httpOnly: true,
sameSite: "none",
secure: true,
},
},
};
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [Google],
cookies: process.env.NODE_ENV !== "production" ? devCookiesConfig : undefined,
});