feat: replace discord auth provider with github

This commit is contained in:
TOHAACK 2024-04-19 10:29:19 +02:00
parent ce85ce9924
commit cd67d9d335
No known key found for this signature in database
3 changed files with 12 additions and 12 deletions

View File

@ -20,6 +20,6 @@ DATABASE_URL="file:./db.sqlite"
# NEXTAUTH_SECRET="" # NEXTAUTH_SECRET=""
NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_URL="http://localhost:3000"
# Next Auth Discord Provider # Next Auth GitHub Provider
DISCORD_CLIENT_ID="" GITHUB_CLIENT_ID=""
DISCORD_CLIENT_SECRET="" GITHUB_CLIENT_SECRET=""

View File

@ -22,8 +22,8 @@ export const env = createEnv({
// VERCEL_URL doesn't include `https` so it cant be validated as a URL // VERCEL_URL doesn't include `https` so it cant be validated as a URL
process.env.VERCEL ? z.string() : z.string().url() process.env.VERCEL ? z.string() : z.string().url()
), ),
DISCORD_CLIENT_ID: z.string(), GITHUB_CLIENT_ID: z.string(),
DISCORD_CLIENT_SECRET: z.string(), GITHUB_CLIENT_SECRET: z.string(),
}, },
/** /**
@ -44,8 +44,8 @@ export const env = createEnv({
NODE_ENV: process.env.NODE_ENV, NODE_ENV: process.env.NODE_ENV,
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET, NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
NEXTAUTH_URL: process.env.NEXTAUTH_URL, NEXTAUTH_URL: process.env.NEXTAUTH_URL,
DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID, GITHUB_CLIENT_ID: process.env.GITHUB_CLIENT_ID,
DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET, GITHUB_CLIENT_SECRET: process.env.GITHUB_CLIENT_SECRET,
}, },
/** /**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially

View File

@ -5,7 +5,7 @@ import {
type NextAuthOptions, type NextAuthOptions,
} from "next-auth"; } from "next-auth";
import { type Adapter } from "next-auth/adapters"; import { type Adapter } from "next-auth/adapters";
import DiscordProvider from "next-auth/providers/discord"; import GitHubProvider from "next-auth/providers/github";
import { env } from "@/env"; import { env } from "@/env";
import { db } from "@/server/db"; import { db } from "@/server/db";
@ -48,14 +48,14 @@ export const authOptions: NextAuthOptions = {
}, },
adapter: PrismaAdapter(db) as Adapter, adapter: PrismaAdapter(db) as Adapter,
providers: [ providers: [
DiscordProvider({ GitHubProvider({
clientId: env.DISCORD_CLIENT_ID, clientId: env.GITHUB_CLIENT_ID,
clientSecret: env.DISCORD_CLIENT_SECRET, clientSecret: env.GITHUB_CLIENT_SECRET,
}), }),
/** /**
* ...add more providers here. * ...add more providers here.
* *
* Most other providers require a bit more work than the Discord provider. For example, the * Most other providers require a bit more work than the GITHUB provider. For example, the
* GitHub provider requires you to add the `refresh_token_expires_in` field to the Account * GitHub provider requires you to add the `refresh_token_expires_in` field to the Account
* model. Refer to the NextAuth.js docs for the provider you want to use. Example: * model. Refer to the NextAuth.js docs for the provider you want to use. Example:
* *