mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 15:05:35 +00:00
fix: cookies cannot be used by browser extension
when cookies are set with same site policy, they cannot be used in an iframe (as the official extension does)
This commit is contained in:
@@ -19,6 +19,12 @@ const checkProvider = (provider: string) => provider === "google";
|
||||
const checkAccountDataReceived = (profile: Profile) =>
|
||||
!!profile?.sub && !!profile?.email;
|
||||
|
||||
const cookieOptions = {
|
||||
sameSite: "None",
|
||||
path: "/",
|
||||
secure: true,
|
||||
};
|
||||
|
||||
export const authOptions = {
|
||||
providers: [
|
||||
GoogleProvider({
|
||||
@@ -75,5 +81,19 @@ export const authOptions = {
|
||||
error: PATHS.LOGIN,
|
||||
signOut: PATHS.LOGOUT,
|
||||
},
|
||||
cookies: {
|
||||
sessionToken: {
|
||||
name: "next-auth.session-token",
|
||||
options: cookieOptions,
|
||||
},
|
||||
callbackUrl: {
|
||||
name: "next-auth.callback-url",
|
||||
options: cookieOptions,
|
||||
},
|
||||
csrfToken: {
|
||||
name: "next-auth.csrf-token",
|
||||
options: cookieOptions,
|
||||
},
|
||||
},
|
||||
} as NextAuthOptions;
|
||||
export default NextAuth(authOptions);
|
||||
|
||||
Reference in New Issue
Block a user