add google provider to nextauth

This commit is contained in:
Matthias Nannt
2023-05-19 14:28:46 +02:00
parent c6aabc77b4
commit d8f4ee598d
6 changed files with 17 additions and 0 deletions

View File

@@ -92,3 +92,5 @@ GITHUB_SECRET=
# Configure Google Login
NEXT_PUBLIC_GOOGLE_AUTH_ENABLED=0
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

View File

@@ -92,6 +92,8 @@ GITHUB_SECRET=
# Configure Google Login
NEXT_PUBLIC_GOOGLE_AUTH_ENABLED=0
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
# Stripe Billing Variables

View File

@@ -5,6 +5,7 @@ import type { IdentityProvider } from "@prisma/client";
import type { NextAuthOptions } from "next-auth";
import CredentialsProvider from "next-auth/providers/credentials";
import GitHubProvider from "next-auth/providers/github";
import GoogleProvider from "next-auth/providers/google";
export const authOptions: NextAuthOptions = {
providers: [
@@ -122,6 +123,11 @@ export const authOptions: NextAuthOptions = {
clientId: process.env.GITHUB_ID || "",
clientSecret: process.env.GITHUB_SECRET || "",
}),
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID || "",
clientSecret: process.env.GOOGLE_CLIENT_SECRET || "",
allowDangerousEmailAccountLinking: true,
}),
],
callbacks: {
async jwt({ token }) {

View File

@@ -16,6 +16,10 @@ const nextConfig = {
protocol: "https",
hostname: "avatars.githubusercontent.com",
},
{
protocol: "https",
hostname: "lh3.googleusercontent.com",
},
],
},
async headers() {

View File

@@ -316,6 +316,7 @@ model ApiKey {
enum IdentityProvider {
email
github
google
}
model Account {

View File

@@ -8,6 +8,8 @@
"FORMBRICKS_LEGACY_HOST",
"GITHUB_ID",
"GITHUB_SECRET",
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
"HEROKU_APP_NAME",
"INSTANCE_ID",
"INTERNAL_SECRET",