-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.config.ts
41 lines (39 loc) · 1.07 KB
/
auth.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { NextAuthConfig } from "next-auth";
import CredentialProvider from "next-auth/providers/credentials";
import GithubProvider from "next-auth/providers/github";
const authConfig: NextAuthConfig = {
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID ?? "",
clientSecret: process.env.GITHUB_SECRET ?? "",
}),
CredentialProvider({
credentials: {
email: { type: "email" },
password: { type: "password" },
},
async authorize(credentials) {
const user = { id: "1", name: "John", email: credentials?.email as string };
if (user) return user;
return null;
},
}),
],
pages: {
signIn: "/",
},
callbacks: {
async jwt({ token, account }) {
if (account?.access_token) {
token.supabaseAccessToken = account.access_token;
}
return token;
},
async session({ session, token }) {
session.supabaseAccessToken = token.supabaseAccessToken as any;
return session;
},
},
secret: process.env.NEXTAUTH_SECRET,
};
export default authConfig;