Skip to content

Commit 30ae230

Browse files
committed
chore: set up auth instance
1 parent 6b9fa9c commit 30ae230

File tree

3 files changed

+177
-0
lines changed

3 files changed

+177
-0
lines changed

lib/auth.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { betterAuth } from "better-auth";
2+
3+
export const auth = betterAuth({
4+
// No database configuration - running in stateless mode
5+
session: {
6+
expiresIn: 60 * 60 * 24 * 7, // 7 days
7+
cookieCache: {
8+
enabled: true,
9+
maxAge: 30 * 24 * 60 * 60, // 30 days cache duration
10+
strategy: "jwe", // Use encrypted tokens for better security
11+
refreshCache: true, // Enable stateless refresh
12+
},
13+
},
14+
socialProviders: {
15+
// Configure your OIDC provider here
16+
// Replace the env vars in .env.local with your actual OIDC provider details
17+
oidc: {
18+
clientId: process.env.OIDC_CLIENT_ID || "",
19+
clientSecret: process.env.OIDC_CLIENT_SECRET || "",
20+
issuer: process.env.OIDC_ISSUER_URL || "", // Your OIDC provider's issuer URL
21+
},
22+
},
23+
});

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"type-check": "tsc --noEmit"
1414
},
1515
"dependencies": {
16+
"better-auth": "1.4.0-beta.20",
1617
"next": "16.0.2",
1718
"react": "19.2.0",
1819
"react-dom": "19.2.0"

pnpm-lock.yaml

Lines changed: 153 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)