make the GOOGLE provider env variables optional
This commit is contained in:
parent
0a26914f7e
commit
80920a1e0a
3 changed files with 11 additions and 7 deletions
|
|
@ -19,8 +19,8 @@ const server = z.object({
|
||||||
process.env.VERCEL ? z.string().min(1) : z.string().url()
|
process.env.VERCEL ? z.string().min(1) : z.string().url()
|
||||||
),
|
),
|
||||||
// Add `.min(1) on ID and SECRET if you want to make sure they're not empty
|
// Add `.min(1) on ID and SECRET if you want to make sure they're not empty
|
||||||
GOOGLE_CLIENT_ID: z.string(),
|
GOOGLE_CLIENT_ID: z.string().nullish(),
|
||||||
GOOGLE_CLIENT_SECRET: z.string(),
|
GOOGLE_CLIENT_SECRET: z.string().nullish(),
|
||||||
GITHUB_ID: z.string(),
|
GITHUB_ID: z.string(),
|
||||||
GITHUB_SECRET: z.string(),
|
GITHUB_SECRET: z.string(),
|
||||||
AWS_ENDPOINT: z.string(),
|
AWS_ENDPOINT: z.string(),
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const SignIn = ({
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
</Head>
|
</Head>
|
||||||
<main className="flex min-h-screen flex-col items-center justify-center bg-[#f9fafb]">
|
<main className="flex min-h-screen flex-col items-center justify-center bg-[#f9fafb]">
|
||||||
<div className="bg-white px-4 py-8 shadow shadow sm:rounded-lg sm:px-10">
|
<div className="bg-white px-4 py-8 shadow sm:rounded-lg sm:px-10">
|
||||||
<div className="animate-fade-in flex flex-col justify-center text-center">
|
<div className="animate-fade-in flex flex-col justify-center text-center">
|
||||||
<span className="text-sm font-medium text-gray-700">
|
<span className="text-sm font-medium text-gray-700">
|
||||||
Sign in with
|
Sign in with
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,14 @@ export const authOptions: NextAuthOptions = {
|
||||||
},
|
},
|
||||||
adapter: PrismaAdapter(prisma),
|
adapter: PrismaAdapter(prisma),
|
||||||
providers: [
|
providers: [
|
||||||
GoogleProvider({
|
...(!!env.GOOGLE_CLIENT_ID && !!env.GOOGLE_CLIENT_SECRET
|
||||||
clientId: env.GOOGLE_CLIENT_ID,
|
? [
|
||||||
clientSecret: env.GOOGLE_CLIENT_SECRET,
|
GoogleProvider({
|
||||||
}),
|
clientId: env.GOOGLE_CLIENT_ID,
|
||||||
|
clientSecret: env.GOOGLE_CLIENT_SECRET,
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
: []),
|
||||||
GitHubProvider({
|
GitHubProvider({
|
||||||
clientId: env.GITHUB_ID,
|
clientId: env.GITHUB_ID,
|
||||||
clientSecret: env.GITHUB_SECRET,
|
clientSecret: env.GITHUB_SECRET,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue