From 40429dc39e039328dccbd45ead6048237655d599 Mon Sep 17 00:00:00 2001 From: awtkns Date: Sat, 15 Apr 2023 07:18:52 +0300 Subject: [PATCH] Add discord provider --- src/server/auth.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/server/auth.ts b/src/server/auth.ts index 6f00a5435b..d827a3eefd 100644 --- a/src/server/auth.ts +++ b/src/server/auth.ts @@ -6,9 +6,10 @@ import { } from "next-auth"; import GithubProvider from "next-auth/providers/github"; import GoogleProvider from "next-auth/providers/google"; +import DiscordProvider from "next-auth/providers/discord"; import { PrismaAdapter } from "@next-auth/prisma-adapter"; import { prisma } from "./db"; -import { env } from "../env/server.mjs"; +import { serverEnv } from "../env/schema.mjs"; /** * Module augmentation for `next-auth` types @@ -33,13 +34,18 @@ declare module "next-auth" { const providers = [ GoogleProvider({ - clientId: env.GOOGLE_CLIENT_ID ?? "", - clientSecret: env.GOOGLE_CLIENT_SECRET ?? "", + clientId: serverEnv.GOOGLE_CLIENT_ID ?? "", + clientSecret: serverEnv.GOOGLE_CLIENT_SECRET ?? "", allowDangerousEmailAccountLinking: true, }), GithubProvider({ - clientId: env.GITHUB_CLIENT_ID ?? "", - clientSecret: env.GITHUB_CLIENT_SECRET ?? "", + clientId: serverEnv.GITHUB_CLIENT_ID ?? "", + clientSecret: serverEnv.GITHUB_CLIENT_SECRET ?? "", + allowDangerousEmailAccountLinking: true, + }), + DiscordProvider({ + clientId: serverEnv.DISCORD_CLIENT_ID ?? "", + clientSecret: serverEnv.DISCORD_CLIENT_SECRET ?? "", allowDangerousEmailAccountLinking: true, }), ];