-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.ts
More file actions
37 lines (34 loc) · 794 Bytes
/
auth.ts
File metadata and controls
37 lines (34 loc) · 794 Bytes
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
import NextAuth from "next-auth";
import Google from "next-auth/providers/google";
function safeStringify(value: unknown) {
const seen = new WeakSet<object>();
return JSON.stringify(
value,
(_k, v) => {
if (v instanceof Error) {
const anyErr = v as any;
return {
name: v.name,
message: v.message,
stack: v.stack,
cause: anyErr?.cause,
...anyErr,
};
}
if (typeof v === "object" && v !== null) {
if (seen.has(v as object)) return "[Circular]";
seen.add(v as object);
}
return v;
},
2,
);
}
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [Google],
pages: {
signIn: "/login",
},
trustHost: true,
debug: true,
});