Created
November 26, 2023 02:11
-
-
Save FrancisGregori/e4d363124f2401bd65e3b0b5f496980c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NextAuth from 'next-auth/next'; | |
import GoogleProvider from 'next-auth/providers/google'; | |
const useSecureCookies = !!process.env.VERCEL_URL; | |
const handler = NextAuth({ | |
providers: [ | |
GoogleProvider({ | |
clientId: process.env.GOOGLE_CLIENT_ID ?? '', | |
clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? '', | |
}), | |
], | |
secret: process.env.NEXTAUTH_SECRET, | |
cookies: { | |
sessionToken: { | |
name: `${useSecureCookies ? '__Secure-' : ''}next-auth.session-token`, | |
options: { | |
httpOnly: true, | |
sameSite: 'lax', | |
path: '/', | |
domain: `.${process.env.BASE_DOMAIN}`, | |
secure: useSecureCookies, | |
}, | |
}, | |
}, | |
}); | |
export { handler as GET, handler as POST }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment