diff options
| author | trisusilo <tri.susilo@altama.co.id> | 2023-08-18 04:00:24 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2023-08-18 04:00:24 +0000 |
| commit | 395d4868ff32e9db97ae467a28660f719da1e653 (patch) | |
| tree | 81e38caaee094ea6e3f1474b1d9174f3837f56dc /src/pages/api | |
| parent | 109019a3b75507700b2db56ce9a136151dd778cf (diff) | |
| parent | b6f6bf23f90ff0dfadf9bf0af8866c2cfc17aa9c (diff) | |
Merged in Feature/google_sign_up (pull request #48)
Feature/google sign up
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 +}) |
