implement google and github login
This commit is contained in:
parent
4ed74711f9
commit
e270079c86
2 changed files with 18 additions and 1 deletions
|
|
@ -19,6 +19,10 @@ 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_SECRET: z.string(),
|
||||||
|
GITHUB_ID: z.string(),
|
||||||
|
GITHUB_SECRET: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -41,6 +45,10 @@ const processEnv = {
|
||||||
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
|
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
|
||||||
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
|
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
|
||||||
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
|
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
|
||||||
|
GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID,
|
||||||
|
GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET,
|
||||||
|
GITHUB_ID: process.env.GITHUB_ID,
|
||||||
|
GITHUB_SECRET: process.env.GITHUB_SECRET,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Don't touch the part below
|
// Don't touch the part below
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ import {
|
||||||
type NextAuthOptions,
|
type NextAuthOptions,
|
||||||
type DefaultSession,
|
type DefaultSession,
|
||||||
} from "next-auth";
|
} from "next-auth";
|
||||||
import DiscordProvider from "next-auth/providers/discord";
|
import GoogleProvider from "next-auth/providers/google";
|
||||||
|
import GitHubProvider from "next-auth/providers/github";
|
||||||
import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
||||||
import { env } from "~/env.mjs";
|
import { env } from "~/env.mjs";
|
||||||
import { prisma } from "~/server/db";
|
import { prisma } from "~/server/db";
|
||||||
|
|
@ -47,6 +48,14 @@ export const authOptions: NextAuthOptions = {
|
||||||
},
|
},
|
||||||
adapter: PrismaAdapter(prisma),
|
adapter: PrismaAdapter(prisma),
|
||||||
providers: [
|
providers: [
|
||||||
|
GoogleProvider({
|
||||||
|
clientId: env.GOOGLE_CLIENT_ID,
|
||||||
|
clientSecret: env.GOOGLE_CLIENT_SECRET
|
||||||
|
}),
|
||||||
|
GitHubProvider({
|
||||||
|
clientId: env.GITHUB_ID,
|
||||||
|
clientSecret: env.GITHUB_SECRET
|
||||||
|
})
|
||||||
/**
|
/**
|
||||||
* ...add more providers here.
|
* ...add more providers here.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue