-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.config.ts
More file actions
30 lines (27 loc) · 878 Bytes
/
auth.config.ts
File metadata and controls
30 lines (27 loc) · 878 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
import { NextAuthConfig } from "next-auth";
export const authConfig: NextAuthConfig = {
pages: {
signIn: "/auth/signin",
error: "/auth/error",
},
session: {
strategy: "jwt",
maxAge: 7 * 24 * 60 * 60, // 7 days
},
callbacks: {
authorized({ auth, request: { nextUrl } }) {
const isLoggedIn = !!auth?.user;
const isProtected = nextUrl.pathname.startsWith("/api/v1/snapshots/download") ||
nextUrl.pathname.startsWith("/dashboard") ||
nextUrl.pathname.startsWith("/teams") ||
nextUrl.pathname.startsWith("/settings");
if (isProtected && !isLoggedIn) {
return false;
}
return true;
},
},
providers: [], // Configured in auth.ts
debug: process.env.NODE_ENV === "development",
trustHost: true, // Trust the host in production
};