add google provider

上级 a76df723
......@@ -32,6 +32,8 @@ POSTGRES_DATABASE=""
# Providers
GITHUB_ID=""
GITHUB_SECRET=""
GOOGLE_ID=""
GOOGLE_SECRET=""
# Auth config
NEXTAUTH_SECRET=""
......
import Signin from '@/components/layout/Signin';
import Signin from '@/components/Signin';
export const metadata = {
title: 'Tabler Sign in',
......
import Signup from '@/components/layout/Signup';
import Signup from '@/components/Signup';
export const metadata = {
title: 'Tabler Sign up',
......
......@@ -8,7 +8,7 @@ import { signIn } from 'next-auth/react';
export default function Signin() {
const router = useRouter();'/';
const handleLogin = async (provider: 'github'): Promise<void> => {
const handleLogin = async (provider: 'github' | 'google'): Promise<void> => {
await signIn(provider, {callbackUrl: '/'});
};
......@@ -47,6 +47,12 @@ export default function Signin() {
Login with Github
</a>
</div>
<div className="col">
<a onClick={() => handleLogin('google')} className="btn w-100">
{/* <Icon name="brand-google"/> */}
Login with Google
</a>
</div>
</div>
</div>
</div>
......
import prisma from '@/lib/prisma';
import { PrismaAdapter } from '@next-auth/prisma-adapter';
import GitHubProvider from 'next-auth/providers/github';
import prisma from '@/lib/prisma';
import GoogleProvider from 'next-auth/providers/google';
export const authConfig = {
providers: [
......@@ -8,6 +9,10 @@ export const authConfig = {
clientId: process.env.GITHUB_ID as string,
clientSecret: process.env.GITHUB_SECRET as string,
}),
GoogleProvider({
clientId: process.env.GOOGLE_ID as string,
clientSecret: process.env.GOOGLE_SECRET as string,
}),
],
pages: {
signIn: '/signin',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册