diff options
Diffstat (limited to 'src/pages/api')
| -rw-r--r-- | src/pages/api/auth/[...nextauth].js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pages/api/auth/[...nextauth].js b/src/pages/api/auth/[...nextauth].js new file mode 100644 index 00000000..3c433167 --- /dev/null +++ b/src/pages/api/auth/[...nextauth].js @@ -0,0 +1,26 @@ +import odooApi from '@/core/api/odooApi' +import NextAuth from 'next-auth/next' +import GoogleProvider from 'next-auth/providers/google' + +export default NextAuth({ + providers: [ + GoogleProvider({ + clientId: process.env.GOOGLE_CLIENT_ID, + clientSecret: process.env.GOOGLE_CLIENT_SECRET + }) + ], + callbacks: { + async jwt({ token, account }) { + if (account) { + token.accessToken = account.access_token + } + return token + }, + async session({ session, token, user }) { + session.accessToken = token.accessToken + + return session + } + }, + secret: process.env.JWT_SECRET +}) |
