mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-03-29 03:29:13 +00:00
feat: google login
This commit is contained in:
parent
eaa6c97c57
commit
114526221b
3 changed files with 13 additions and 2 deletions
|
|
@ -18,6 +18,8 @@ AUTH_DISCORD_ID=XXXXXXXXXXXXXXXX
|
||||||
AUTH_DISCORD_SECRET=XXXXXXXXXXXXXXXX
|
AUTH_DISCORD_SECRET=XXXXXXXXXXXXXXXX
|
||||||
AUTH_GITHUB_ID=XXXXXXXXXXXXXXXX
|
AUTH_GITHUB_ID=XXXXXXXXXXXXXXXX
|
||||||
AUTH_GITHUB_SECRET=XXXXXXXXXXXXXXXX
|
AUTH_GITHUB_SECRET=XXXXXXXXXXXXXXXX
|
||||||
|
AUTH_GOOGLE_ID=XXXXXXXXXXXXXXXX
|
||||||
|
AUTH_GOOGLE_SECRET=XXXXXXXXXXXXXXXX
|
||||||
|
|
||||||
# Currently only supports one admin
|
# Currently only supports one admin
|
||||||
NEXT_PUBLIC_ADMIN_USER_ID=1
|
NEXT_PUBLIC_ADMIN_USER_ID=1
|
||||||
|
|
@ -25,4 +27,4 @@ NEXT_PUBLIC_ADMIN_USER_ID=1
|
||||||
NEXT_PUBLIC_CONTRIBUTORS_USER_IDS=176
|
NEXT_PUBLIC_CONTRIBUTORS_USER_IDS=176
|
||||||
|
|
||||||
# Sends notifications (such as admin reports) to ntfy
|
# Sends notifications (such as admin reports) to ntfy
|
||||||
NTFY_URL="https://ntfy.yourdomain.com/tomodachi-share"
|
NTFY_URL="https://ntfy.yourdomain.com/tomodachi-share"
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,14 @@ export default function LoginButtons() {
|
||||||
<Icon icon="mdi:github" fontSize={32} />
|
<Icon icon="mdi:github" fontSize={32} />
|
||||||
Login with GitHub
|
Login with GitHub
|
||||||
</button>
|
</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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
import NextAuth from "next-auth";
|
import NextAuth from "next-auth";
|
||||||
import Discord from "next-auth/providers/discord";
|
import Discord from "next-auth/providers/discord";
|
||||||
import Github from "next-auth/providers/github";
|
import Github from "next-auth/providers/github";
|
||||||
|
import Google from "next-auth/providers/google";
|
||||||
|
|
||||||
import { PrismaAdapter } from "@auth/prisma-adapter";
|
import { PrismaAdapter } from "@auth/prisma-adapter";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const { handlers, signIn, signOut, auth } = NextAuth({
|
export const { handlers, signIn, signOut, auth } = NextAuth({
|
||||||
adapter: PrismaAdapter(prisma),
|
adapter: PrismaAdapter(prisma),
|
||||||
providers: [Discord, Github],
|
providers: [Discord, Github, Google],
|
||||||
pages: {
|
pages: {
|
||||||
signIn: "/login",
|
signIn: "/login",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue