@sigma-auth/better-auth-plugin 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -0
- package/dist/payload/index.d.ts +138 -0
- package/dist/payload/index.d.ts.map +1 -0
- package/dist/payload/index.js +252 -0
- package/dist/payload/index.js.map +1 -0
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ This package provides multiple entry points for different use cases:
|
|
|
17
17
|
- **`/client`** - Browser-side OAuth client with PKCE
|
|
18
18
|
- **`/server`** - Server-side utilities for token exchange
|
|
19
19
|
- **`/next`** - Next.js API route handlers
|
|
20
|
+
- **`/payload`** - Payload CMS integration with session management
|
|
20
21
|
- **`/provider`** - Better Auth server plugin for OIDC provider
|
|
21
22
|
|
|
22
23
|
## Architecture
|
|
@@ -233,6 +234,103 @@ const { data: session } = useSession();
|
|
|
233
234
|
|
|
234
235
|
This requires setting up Better Auth server with the Sigma provider plugin on your domain.
|
|
235
236
|
|
|
237
|
+
## Payload CMS Integration
|
|
238
|
+
|
|
239
|
+
For Payload CMS apps using [payload-auth](https://github.com/b-open-io/payload-auth), the `/payload` entry point provides a callback handler that automatically:
|
|
240
|
+
|
|
241
|
+
1. Exchanges the authorization code for tokens
|
|
242
|
+
2. Finds or creates a user in your Payload users collection
|
|
243
|
+
3. Creates a better-auth session in Payload's sessions collection
|
|
244
|
+
4. Sets the session cookie
|
|
245
|
+
|
|
246
|
+
### Setup
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
// app/api/auth/sigma/callback/route.ts
|
|
250
|
+
import configPromise from "@payload-config";
|
|
251
|
+
import { createPayloadCallbackHandler } from "@sigma-auth/better-auth-plugin/payload";
|
|
252
|
+
|
|
253
|
+
export const runtime = "nodejs";
|
|
254
|
+
export const POST = createPayloadCallbackHandler({ configPromise });
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Custom User Creation
|
|
258
|
+
|
|
259
|
+
Override the default user creation to add custom fields:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
export const POST = createPayloadCallbackHandler({
|
|
263
|
+
configPromise,
|
|
264
|
+
createUser: async (payload, sigmaUser) => {
|
|
265
|
+
return payload.create({
|
|
266
|
+
collection: "users",
|
|
267
|
+
data: {
|
|
268
|
+
email: sigmaUser.email || `${sigmaUser.sub}@sigma.identity`,
|
|
269
|
+
name: sigmaUser.name || sigmaUser.sub,
|
|
270
|
+
emailVerified: true,
|
|
271
|
+
role: ["subscriber"], // Custom role
|
|
272
|
+
bapId: sigmaUser.bap_id,
|
|
273
|
+
pubkey: sigmaUser.pubkey,
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Configuration Options
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
interface PayloadCallbackConfig {
|
|
284
|
+
/** Payload config promise (required) */
|
|
285
|
+
configPromise: Promise<unknown>;
|
|
286
|
+
|
|
287
|
+
/** Sigma Auth server URL (default: NEXT_PUBLIC_SIGMA_AUTH_URL) */
|
|
288
|
+
issuerUrl?: string;
|
|
289
|
+
|
|
290
|
+
/** OAuth client ID (default: NEXT_PUBLIC_SIGMA_CLIENT_ID) */
|
|
291
|
+
clientId?: string;
|
|
292
|
+
|
|
293
|
+
/** Member private key (default: SIGMA_MEMBER_PRIVATE_KEY env) */
|
|
294
|
+
memberPrivateKey?: string;
|
|
295
|
+
|
|
296
|
+
/** Callback path (default: /auth/sigma/callback) */
|
|
297
|
+
callbackPath?: string;
|
|
298
|
+
|
|
299
|
+
/** Users collection slug (default: "users") */
|
|
300
|
+
usersCollection?: string;
|
|
301
|
+
|
|
302
|
+
/** Sessions collection slug (default: "sessions") */
|
|
303
|
+
sessionsCollection?: string;
|
|
304
|
+
|
|
305
|
+
/** Session cookie name (default: "better-auth.session_token") */
|
|
306
|
+
sessionCookieName?: string;
|
|
307
|
+
|
|
308
|
+
/** Session duration in ms (default: 30 days) */
|
|
309
|
+
sessionDuration?: number;
|
|
310
|
+
|
|
311
|
+
/** Custom user creation handler */
|
|
312
|
+
createUser?: (payload, sigmaUser) => Promise<{ id: string | number }>;
|
|
313
|
+
|
|
314
|
+
/** Custom user lookup handler */
|
|
315
|
+
findUser?: (payload, sigmaUser) => Promise<{ id: string | number } | null>;
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Response
|
|
320
|
+
|
|
321
|
+
The callback returns `PayloadCallbackResult`:
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
{
|
|
325
|
+
user: SigmaUserInfo; // Sigma identity data
|
|
326
|
+
access_token: string; // Access token
|
|
327
|
+
id_token: string; // OIDC ID token
|
|
328
|
+
refresh_token?: string; // Refresh token (if issued)
|
|
329
|
+
payloadUserId: string; // Local Payload user ID
|
|
330
|
+
isNewUser: boolean; // True if user was just created
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
236
334
|
## Server Plugin (Auth Provider)
|
|
237
335
|
|
|
238
336
|
For building your own Sigma Identity server:
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payload CMS integration for Sigma Auth
|
|
3
|
+
* Provides callback handler that creates local better-auth sessions for Payload
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* // app/api/auth/sigma/callback/route.ts
|
|
8
|
+
* import configPromise from "@payload-config";
|
|
9
|
+
* import { createPayloadCallbackHandler } from "@sigma-auth/better-auth-plugin/payload";
|
|
10
|
+
*
|
|
11
|
+
* export const POST = createPayloadCallbackHandler({ configPromise });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
import { type TokenExchangeResult } from "../server/index.js";
|
|
15
|
+
/**
|
|
16
|
+
* Next.js request interface (minimal typing for compatibility)
|
|
17
|
+
*/
|
|
18
|
+
interface NextRequest {
|
|
19
|
+
json(): Promise<unknown>;
|
|
20
|
+
url: string;
|
|
21
|
+
headers: Headers;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Payload instance with better-auth (from payload-auth)
|
|
25
|
+
*/
|
|
26
|
+
interface PayloadWithBetterAuth {
|
|
27
|
+
find: (args: {
|
|
28
|
+
collection: string;
|
|
29
|
+
where: Record<string, unknown>;
|
|
30
|
+
limit: number;
|
|
31
|
+
}) => Promise<{
|
|
32
|
+
docs: Array<{
|
|
33
|
+
id: number | string;
|
|
34
|
+
}>;
|
|
35
|
+
}>;
|
|
36
|
+
create: (args: {
|
|
37
|
+
collection: string;
|
|
38
|
+
data: Record<string, unknown>;
|
|
39
|
+
}) => Promise<{
|
|
40
|
+
id: number | string;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Configuration for the Payload callback handler
|
|
45
|
+
*/
|
|
46
|
+
export interface PayloadCallbackConfig {
|
|
47
|
+
/**
|
|
48
|
+
* Payload config promise (import configPromise from "@payload-config")
|
|
49
|
+
* Will be used to get the Payload instance via getPayloadAuth
|
|
50
|
+
*/
|
|
51
|
+
configPromise: Promise<unknown>;
|
|
52
|
+
/**
|
|
53
|
+
* Function to get the Payload instance with better-auth
|
|
54
|
+
* If not provided, will dynamically import from payload-auth/better-auth
|
|
55
|
+
*/
|
|
56
|
+
getPayloadAuth?: (config: Promise<unknown>) => Promise<PayloadWithBetterAuth>;
|
|
57
|
+
/** Sigma Auth server URL (default: NEXT_PUBLIC_SIGMA_AUTH_URL or https://auth.sigmaidentity.com) */
|
|
58
|
+
issuerUrl?: string;
|
|
59
|
+
/** OAuth client ID (default: NEXT_PUBLIC_SIGMA_CLIENT_ID) */
|
|
60
|
+
clientId?: string;
|
|
61
|
+
/** Member private key for signing (default: SIGMA_MEMBER_PRIVATE_KEY env) */
|
|
62
|
+
memberPrivateKey?: string;
|
|
63
|
+
/** Callback path (default: /auth/sigma/callback) */
|
|
64
|
+
callbackPath?: string;
|
|
65
|
+
/** Users collection slug (default: "users") */
|
|
66
|
+
usersCollection?: string;
|
|
67
|
+
/** Sessions collection slug (default: "sessions") */
|
|
68
|
+
sessionsCollection?: string;
|
|
69
|
+
/** Session cookie name (default: "better-auth.session_token") */
|
|
70
|
+
sessionCookieName?: string;
|
|
71
|
+
/** Session duration in milliseconds (default: 30 days) */
|
|
72
|
+
sessionDuration?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Custom user creation handler
|
|
75
|
+
* Override to customize how users are created from Sigma identity
|
|
76
|
+
*/
|
|
77
|
+
createUser?: (payload: PayloadWithBetterAuth, sigmaUser: TokenExchangeResult["user"]) => Promise<{
|
|
78
|
+
id: number | string;
|
|
79
|
+
}>;
|
|
80
|
+
/**
|
|
81
|
+
* Custom user lookup handler
|
|
82
|
+
* Override to customize how existing users are found
|
|
83
|
+
*/
|
|
84
|
+
findUser?: (payload: PayloadWithBetterAuth, sigmaUser: TokenExchangeResult["user"]) => Promise<{
|
|
85
|
+
id: number | string;
|
|
86
|
+
} | null>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Result returned from the callback handler
|
|
90
|
+
*/
|
|
91
|
+
export interface PayloadCallbackResult extends TokenExchangeResult {
|
|
92
|
+
/** The Payload user ID that was created or found */
|
|
93
|
+
payloadUserId: string;
|
|
94
|
+
/** Whether a new user was created */
|
|
95
|
+
isNewUser: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Creates a Next.js POST route handler for Sigma OAuth callback with Payload session creation
|
|
99
|
+
*
|
|
100
|
+
* This handler:
|
|
101
|
+
* 1. Exchanges the authorization code for tokens
|
|
102
|
+
* 2. Finds or creates a user in Payload
|
|
103
|
+
* 3. Creates a better-auth session in Payload's sessions collection
|
|
104
|
+
* 4. Sets the session cookie
|
|
105
|
+
* 5. Returns the tokens and user data
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* // app/api/auth/sigma/callback/route.ts
|
|
110
|
+
* import configPromise from "@payload-config";
|
|
111
|
+
* import { createPayloadCallbackHandler } from "@sigma-auth/better-auth-plugin/payload";
|
|
112
|
+
*
|
|
113
|
+
* export const POST = createPayloadCallbackHandler({ configPromise });
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* // With custom user creation
|
|
119
|
+
* export const POST = createPayloadCallbackHandler({
|
|
120
|
+
* configPromise,
|
|
121
|
+
* createUser: async (payload, sigmaUser) => {
|
|
122
|
+
* return payload.create({
|
|
123
|
+
* collection: "users",
|
|
124
|
+
* data: {
|
|
125
|
+
* email: sigmaUser.email,
|
|
126
|
+
* name: sigmaUser.name,
|
|
127
|
+
* emailVerified: true,
|
|
128
|
+
* role: ["subscriber"], // Custom role
|
|
129
|
+
* bapId: sigmaUser.bap_id,
|
|
130
|
+
* },
|
|
131
|
+
* });
|
|
132
|
+
* },
|
|
133
|
+
* });
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare function createPayloadCallbackHandler(config: PayloadCallbackConfig): (request: NextRequest) => Promise<Response>;
|
|
137
|
+
export {};
|
|
138
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/payload/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAGN,KAAK,mBAAmB,EACxB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,UAAU,WAAW;IACpB,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,UAAU,qBAAqB;IAC9B,IAAI,EAAE,CAAC,IAAI,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC,MAAM,E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C;IAEtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CACV,OAAO,EAAE,qBAAqB,EAC9B,SAAS,EAAE,mBAAmB,CAAC,MAAM,CAAC,KAClC,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IACjE,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,qBAAqB,IAC3D,SAAS,WAAW,uBAsPlC"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payload CMS integration for Sigma Auth
|
|
3
|
+
* Provides callback handler that creates local better-auth sessions for Payload
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* // app/api/auth/sigma/callback/route.ts
|
|
8
|
+
* import configPromise from "@payload-config";
|
|
9
|
+
* import { createPayloadCallbackHandler } from "@sigma-auth/better-auth-plugin/payload";
|
|
10
|
+
*
|
|
11
|
+
* export const POST = createPayloadCallbackHandler({ configPromise });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
import { exchangeCodeForTokens, } from "../server/index.js";
|
|
15
|
+
/**
|
|
16
|
+
* Creates a Next.js POST route handler for Sigma OAuth callback with Payload session creation
|
|
17
|
+
*
|
|
18
|
+
* This handler:
|
|
19
|
+
* 1. Exchanges the authorization code for tokens
|
|
20
|
+
* 2. Finds or creates a user in Payload
|
|
21
|
+
* 3. Creates a better-auth session in Payload's sessions collection
|
|
22
|
+
* 4. Sets the session cookie
|
|
23
|
+
* 5. Returns the tokens and user data
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // app/api/auth/sigma/callback/route.ts
|
|
28
|
+
* import configPromise from "@payload-config";
|
|
29
|
+
* import { createPayloadCallbackHandler } from "@sigma-auth/better-auth-plugin/payload";
|
|
30
|
+
*
|
|
31
|
+
* export const POST = createPayloadCallbackHandler({ configPromise });
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* // With custom user creation
|
|
37
|
+
* export const POST = createPayloadCallbackHandler({
|
|
38
|
+
* configPromise,
|
|
39
|
+
* createUser: async (payload, sigmaUser) => {
|
|
40
|
+
* return payload.create({
|
|
41
|
+
* collection: "users",
|
|
42
|
+
* data: {
|
|
43
|
+
* email: sigmaUser.email,
|
|
44
|
+
* name: sigmaUser.name,
|
|
45
|
+
* emailVerified: true,
|
|
46
|
+
* role: ["subscriber"], // Custom role
|
|
47
|
+
* bapId: sigmaUser.bap_id,
|
|
48
|
+
* },
|
|
49
|
+
* });
|
|
50
|
+
* },
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function createPayloadCallbackHandler(config) {
|
|
55
|
+
return async (request) => {
|
|
56
|
+
try {
|
|
57
|
+
const body = (await request.json());
|
|
58
|
+
const { code, code_verifier } = body;
|
|
59
|
+
if (!code) {
|
|
60
|
+
return Response.json({ error: "Missing authorization code" }, { status: 400 });
|
|
61
|
+
}
|
|
62
|
+
// Get configuration from env or config
|
|
63
|
+
const memberPrivateKey = config.memberPrivateKey || process.env.SIGMA_MEMBER_PRIVATE_KEY;
|
|
64
|
+
if (!memberPrivateKey) {
|
|
65
|
+
console.error("[Sigma Payload Callback] SIGMA_MEMBER_PRIVATE_KEY not configured");
|
|
66
|
+
return Response.json({
|
|
67
|
+
error: "Server configuration error",
|
|
68
|
+
details: "Missing SIGMA_MEMBER_PRIVATE_KEY",
|
|
69
|
+
}, { status: 500 });
|
|
70
|
+
}
|
|
71
|
+
const issuerUrl = config.issuerUrl ||
|
|
72
|
+
process.env.NEXT_PUBLIC_SIGMA_AUTH_URL ||
|
|
73
|
+
"https://auth.sigmaidentity.com";
|
|
74
|
+
const clientId = config.clientId || process.env.NEXT_PUBLIC_SIGMA_CLIENT_ID;
|
|
75
|
+
if (!clientId) {
|
|
76
|
+
console.error("[Sigma Payload Callback] NEXT_PUBLIC_SIGMA_CLIENT_ID not configured");
|
|
77
|
+
return Response.json({ error: "Server configuration error", details: "Missing client ID" }, { status: 500 });
|
|
78
|
+
}
|
|
79
|
+
const callbackPath = config.callbackPath || "/auth/sigma/callback";
|
|
80
|
+
// Determine origin from headers or env
|
|
81
|
+
let origin = process.env.NEXT_PUBLIC_SERVER_URL;
|
|
82
|
+
if (!origin) {
|
|
83
|
+
const forwardedHost = request.headers.get("x-forwarded-host");
|
|
84
|
+
const forwardedProto = request.headers.get("x-forwarded-proto") || "https";
|
|
85
|
+
if (forwardedHost) {
|
|
86
|
+
origin = `${forwardedProto}://${forwardedHost}`;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
origin = new URL(request.url).origin;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const redirectUri = `${origin}${callbackPath}`;
|
|
93
|
+
console.log("[Sigma Payload Callback] Exchanging code for tokens:", {
|
|
94
|
+
issuerUrl,
|
|
95
|
+
clientId,
|
|
96
|
+
redirectUri,
|
|
97
|
+
});
|
|
98
|
+
// Exchange authorization code for tokens
|
|
99
|
+
const result = await exchangeCodeForTokens({
|
|
100
|
+
code,
|
|
101
|
+
redirectUri,
|
|
102
|
+
clientId,
|
|
103
|
+
memberPrivateKey,
|
|
104
|
+
codeVerifier: code_verifier,
|
|
105
|
+
issuerUrl,
|
|
106
|
+
});
|
|
107
|
+
console.log("[Sigma Payload Callback] Token exchange success:", {
|
|
108
|
+
hasBap: !!result.user.bap,
|
|
109
|
+
name: result.user.name,
|
|
110
|
+
bapId: result.user.bap_id?.substring(0, 20) || "none",
|
|
111
|
+
});
|
|
112
|
+
// Get Payload instance
|
|
113
|
+
let payload;
|
|
114
|
+
if (config.getPayloadAuth) {
|
|
115
|
+
payload = await config.getPayloadAuth(config.configPromise);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// Dynamic import to avoid hard dependency
|
|
119
|
+
// @ts-expect-error - payload-auth is an optional peer dependency
|
|
120
|
+
const mod = await import("payload-auth/better-auth");
|
|
121
|
+
payload = await mod.getPayloadAuth(config.configPromise);
|
|
122
|
+
}
|
|
123
|
+
const usersCollection = config.usersCollection || "users";
|
|
124
|
+
const sessionsCollection = config.sessionsCollection || "sessions";
|
|
125
|
+
// Find or create user
|
|
126
|
+
let userId;
|
|
127
|
+
let isNewUser = false;
|
|
128
|
+
if (config.findUser) {
|
|
129
|
+
const existingUser = await config.findUser(payload, result.user);
|
|
130
|
+
if (existingUser) {
|
|
131
|
+
userId = String(existingUser.id);
|
|
132
|
+
}
|
|
133
|
+
else if (config.createUser) {
|
|
134
|
+
const newUser = await config.createUser(payload, result.user);
|
|
135
|
+
userId = String(newUser.id);
|
|
136
|
+
isNewUser = true;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// Default user creation
|
|
140
|
+
const email = result.user.email || `${result.user.sub}@sigma.identity`;
|
|
141
|
+
const newUser = await payload.create({
|
|
142
|
+
collection: usersCollection,
|
|
143
|
+
data: {
|
|
144
|
+
email,
|
|
145
|
+
name: result.user.name || result.user.sub,
|
|
146
|
+
emailVerified: true,
|
|
147
|
+
role: ["user"],
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
userId = String(newUser.id);
|
|
151
|
+
isNewUser = true;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// Default user lookup by email
|
|
156
|
+
const email = result.user.email || `${result.user.sub}@sigma.identity`;
|
|
157
|
+
const users = await payload.find({
|
|
158
|
+
collection: usersCollection,
|
|
159
|
+
where: { email: { equals: email } },
|
|
160
|
+
limit: 1,
|
|
161
|
+
});
|
|
162
|
+
const existingUser = users.docs[0];
|
|
163
|
+
if (existingUser) {
|
|
164
|
+
userId = String(existingUser.id);
|
|
165
|
+
}
|
|
166
|
+
else if (config.createUser) {
|
|
167
|
+
const newUser = await config.createUser(payload, result.user);
|
|
168
|
+
userId = String(newUser.id);
|
|
169
|
+
isNewUser = true;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
// Default user creation
|
|
173
|
+
const newUser = await payload.create({
|
|
174
|
+
collection: usersCollection,
|
|
175
|
+
data: {
|
|
176
|
+
email,
|
|
177
|
+
name: result.user.name || result.user.sub,
|
|
178
|
+
emailVerified: true,
|
|
179
|
+
role: ["user"],
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
userId = String(newUser.id);
|
|
183
|
+
isNewUser = true;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
console.log("[Sigma Payload Callback]", isNewUser ? "Created new user:" : "Found existing user:", userId);
|
|
187
|
+
// Create session
|
|
188
|
+
const sessionToken = crypto.randomUUID();
|
|
189
|
+
const sessionDuration = config.sessionDuration || 30 * 24 * 60 * 60 * 1000; // 30 days
|
|
190
|
+
const expiresAt = new Date(Date.now() + sessionDuration);
|
|
191
|
+
await payload.create({
|
|
192
|
+
collection: sessionsCollection,
|
|
193
|
+
data: {
|
|
194
|
+
token: sessionToken,
|
|
195
|
+
user: Number(userId),
|
|
196
|
+
expiresAt: expiresAt.toISOString(),
|
|
197
|
+
ipAddress: request.headers.get("x-forwarded-for") || undefined,
|
|
198
|
+
userAgent: request.headers.get("user-agent") || undefined,
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
// Set session cookie using dynamic import to avoid hard dependency on next/headers
|
|
202
|
+
const sessionCookieName = config.sessionCookieName || "better-auth.session_token";
|
|
203
|
+
try {
|
|
204
|
+
// @ts-expect-error - next/headers is only available in Next.js route handlers
|
|
205
|
+
const mod = await import("next/headers");
|
|
206
|
+
const cookieStore = await mod.cookies();
|
|
207
|
+
cookieStore.set(sessionCookieName, sessionToken, {
|
|
208
|
+
httpOnly: true,
|
|
209
|
+
secure: process.env.NODE_ENV === "production",
|
|
210
|
+
sameSite: "lax",
|
|
211
|
+
path: "/",
|
|
212
|
+
expires: expiresAt,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
// Fallback: set cookie via response header if next/headers not available
|
|
217
|
+
// This shouldn't happen in Next.js route handlers but provides fallback
|
|
218
|
+
console.warn("[Sigma Payload Callback] Could not set cookie via next/headers");
|
|
219
|
+
}
|
|
220
|
+
console.log("[Sigma Payload Callback] Session created for user:", userId);
|
|
221
|
+
return Response.json({
|
|
222
|
+
user: result.user,
|
|
223
|
+
access_token: result.access_token,
|
|
224
|
+
id_token: result.id_token,
|
|
225
|
+
refresh_token: result.refresh_token,
|
|
226
|
+
payloadUserId: userId,
|
|
227
|
+
isNewUser,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
console.error("[Sigma Payload Callback] Error:", error);
|
|
232
|
+
// Check if it's a TokenExchangeError
|
|
233
|
+
if (error &&
|
|
234
|
+
typeof error === "object" &&
|
|
235
|
+
"error" in error &&
|
|
236
|
+
"endpoint" in error) {
|
|
237
|
+
const tokenError = error;
|
|
238
|
+
return Response.json({
|
|
239
|
+
error: tokenError.error,
|
|
240
|
+
details: tokenError.details,
|
|
241
|
+
status: tokenError.status,
|
|
242
|
+
endpoint: tokenError.endpoint,
|
|
243
|
+
}, { status: tokenError.status || 500 });
|
|
244
|
+
}
|
|
245
|
+
return Response.json({
|
|
246
|
+
error: "Internal server error",
|
|
247
|
+
details: error instanceof Error ? error.message : "Unknown error",
|
|
248
|
+
}, { status: 500 });
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/payload/index.ts"],"names":[],"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,MAAM,EAAE,UAAU,CAAC,MAAM;oBACzB,QAAQ,EAAE,UAAU,CAAC,QAAQ;iBAC7B,EACD,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,GAAG,EAAE,CACpC,CAAC;YACH,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,CACnB;gBACC,KAAK,EAAE,uBAAuB;gBAC9B,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aACjE,EACD,EAAE,MAAM,EAAE,GAAG,EAAE,CACf,CAAC;QACH,CAAC;IACF,CAAC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigma-auth/better-auth-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "Better Auth plugins for Sigma Identity - client, server, and provider integrations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/types/index.js",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"types": "./dist/next/index.d.ts",
|
|
23
23
|
"import": "./dist/next/index.js"
|
|
24
24
|
},
|
|
25
|
+
"./payload": {
|
|
26
|
+
"types": "./dist/payload/index.d.ts",
|
|
27
|
+
"import": "./dist/payload/index.js"
|
|
28
|
+
},
|
|
25
29
|
"./provider": {
|
|
26
30
|
"types": "./dist/provider/index.d.ts",
|
|
27
31
|
"import": "./dist/provider/index.js"
|
|
@@ -62,6 +66,7 @@
|
|
|
62
66
|
"better-auth": "^1.4.5",
|
|
63
67
|
"@bsv/sdk": "^1.9.9",
|
|
64
68
|
"@neondatabase/serverless": "^1.0.2",
|
|
69
|
+
"payload-auth": "^0.6.0",
|
|
65
70
|
"zod": "^4.1.12"
|
|
66
71
|
},
|
|
67
72
|
"peerDependenciesMeta": {
|
|
@@ -71,6 +76,9 @@
|
|
|
71
76
|
"@neondatabase/serverless": {
|
|
72
77
|
"optional": true
|
|
73
78
|
},
|
|
79
|
+
"payload-auth": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
74
82
|
"zod": {
|
|
75
83
|
"optional": true
|
|
76
84
|
}
|