feat: google login

This commit is contained in:
trafficlunar 2026-03-28 16:19:18 +00:00
parent eaa6c97c57
commit 114526221b
3 changed files with 13 additions and 2 deletions

View file

@ -18,6 +18,8 @@ AUTH_DISCORD_ID=XXXXXXXXXXXXXXXX
AUTH_DISCORD_SECRET=XXXXXXXXXXXXXXXX
AUTH_GITHUB_ID=XXXXXXXXXXXXXXXX
AUTH_GITHUB_SECRET=XXXXXXXXXXXXXXXX
AUTH_GOOGLE_ID=XXXXXXXXXXXXXXXX
AUTH_GOOGLE_SECRET=XXXXXXXXXXXXXXXX
# Currently only supports one admin
NEXT_PUBLIC_ADMIN_USER_ID=1
@ -25,4 +27,4 @@ NEXT_PUBLIC_ADMIN_USER_ID=1
NEXT_PUBLIC_CONTRIBUTORS_USER_IDS=176
# Sends notifications (such as admin reports) to ntfy
NTFY_URL="https://ntfy.yourdomain.com/tomodachi-share"
NTFY_URL="https://ntfy.yourdomain.com/tomodachi-share"

View file

@ -22,6 +22,14 @@ export default function LoginButtons() {
<Icon icon="mdi:github" fontSize={32} />
Login with GitHub
</button>
<button
onClick={() => signIn("google", { redirectTo: "/" })}
aria-label="Login with Google"
className="pill button gap-2 px-3! bg-white! border-gray-300! hover:bg-gray-100! text-black! flex items-center"
>
<Icon icon="material-icon-theme:google" fontSize={32} />
Login with Google
</button>
</div>
);
}

View file

@ -1,13 +1,14 @@
import NextAuth from "next-auth";
import Discord from "next-auth/providers/discord";
import Github from "next-auth/providers/github";
import Google from "next-auth/providers/google";
import { PrismaAdapter } from "@auth/prisma-adapter";
import { prisma } from "@/lib/prisma";
export const { handlers, signIn, signOut, auth } = NextAuth({
adapter: PrismaAdapter(prisma),
providers: [Discord, Github],
providers: [Discord, Github, Google],
pages: {
signIn: "/login",
},