naystack 1.4.4 → 1.4.6
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/dist/auth/email/index.cjs.js +15 -4
- package/dist/auth/email/index.d.mts +1 -0
- package/dist/auth/email/index.d.ts +1 -0
- package/dist/auth/email/index.esm.js +14 -4
- package/dist/auth/email/routes/delete.cjs.js +2 -1
- package/dist/auth/email/routes/delete.esm.js +2 -1
- package/dist/auth/email/routes/get.cjs.js +2 -1
- package/dist/auth/email/routes/get.esm.js +2 -1
- package/dist/auth/email/routes/post.cjs.js +1 -1
- package/dist/auth/email/routes/post.esm.js +1 -1
- package/dist/auth/email/routes/put.cjs.js +1 -1
- package/dist/auth/email/routes/put.esm.js +1 -1
- package/dist/auth/email/types.d.mts +5 -5
- package/dist/auth/email/types.d.ts +5 -5
- package/dist/auth/index.cjs.js +15 -4
- package/dist/auth/index.d.mts +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.esm.js +14 -4
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/auth/email/index.ts
|
|
21
21
|
var email_exports = {};
|
|
22
22
|
__export(email_exports, {
|
|
23
|
+
checkAuthStatus: () => checkAuthStatus,
|
|
23
24
|
getEmailAuthRoutes: () => getEmailAuthRoutes
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(email_exports);
|
|
@@ -83,6 +84,13 @@ function verifyUser(user, password) {
|
|
|
83
84
|
if (!user.password) return false;
|
|
84
85
|
return (0, import_bcryptjs.compare)(password, user.password);
|
|
85
86
|
}
|
|
87
|
+
async function checkAuthStatus(redirectUnauthorizedURL) {
|
|
88
|
+
const Cookie = await (0, import_headers.cookies)();
|
|
89
|
+
const isAuthorized = !!Cookie.get(REFRESH_COOKIE_NAME)?.value;
|
|
90
|
+
if (!isAuthorized && redirectUnauthorizedURL)
|
|
91
|
+
return (0, import_navigation.redirect)(redirectUnauthorizedURL);
|
|
92
|
+
return isAuthorized;
|
|
93
|
+
}
|
|
86
94
|
|
|
87
95
|
// src/auth/utils/errors.ts
|
|
88
96
|
var import_server2 = require("next/server");
|
|
@@ -163,7 +171,8 @@ var getContext = (keys, req) => {
|
|
|
163
171
|
var getDeleteRoute = (options) => async (req) => {
|
|
164
172
|
if (options.onLogout) {
|
|
165
173
|
const ctx = await getContext(options.keys, req);
|
|
166
|
-
await
|
|
174
|
+
const body = await req.json();
|
|
175
|
+
await options.onLogout?.(ctx.userId, body);
|
|
167
176
|
}
|
|
168
177
|
return getTokenizedResponse(void 0, "");
|
|
169
178
|
};
|
|
@@ -174,7 +183,8 @@ var getGetRoute = (options) => async (req) => {
|
|
|
174
183
|
const userID = getUserIdFromRefreshToken(options.keys.refresh, refresh);
|
|
175
184
|
if (userID) {
|
|
176
185
|
if (options.onRefresh) {
|
|
177
|
-
await
|
|
186
|
+
const body = await req.json();
|
|
187
|
+
await options.onRefresh?.(userID, body);
|
|
178
188
|
}
|
|
179
189
|
return getTokenizedResponse(
|
|
180
190
|
generateAccessToken(userID, options.keys.signing)
|
|
@@ -205,7 +215,7 @@ var getPostRoute = (options) => async (req) => {
|
|
|
205
215
|
});
|
|
206
216
|
if (newUser) {
|
|
207
217
|
if (options.onSignUp) {
|
|
208
|
-
await options.onSignUp?.(newUser.id,
|
|
218
|
+
await options.onSignUp?.(newUser.id, data);
|
|
209
219
|
}
|
|
210
220
|
return getTokenizedResponse(
|
|
211
221
|
generateAccessToken(newUser.id, options.keys.signing),
|
|
@@ -224,7 +234,7 @@ var getPutRoute = (options) => async (req) => {
|
|
|
224
234
|
return handleError(400, "A user does not exist", options.onError);
|
|
225
235
|
if (await verifyUser(user, data.password)) {
|
|
226
236
|
if (options.onLogin) {
|
|
227
|
-
await options.onLogin?.(user.id,
|
|
237
|
+
await options.onLogin?.(user.id, data);
|
|
228
238
|
}
|
|
229
239
|
return getTokenizedResponse(
|
|
230
240
|
generateAccessToken(user.id, options.keys.signing),
|
|
@@ -246,5 +256,6 @@ function getEmailAuthRoutes(options) {
|
|
|
246
256
|
}
|
|
247
257
|
// Annotate the CommonJS export names for ESM import in node:
|
|
248
258
|
0 && (module.exports = {
|
|
259
|
+
checkAuthStatus,
|
|
249
260
|
getEmailAuthRoutes
|
|
250
261
|
});
|
|
@@ -2,6 +2,7 @@ import * as next_server from 'next/server';
|
|
|
2
2
|
import { NextRequest } from 'next/server';
|
|
3
3
|
import { Context } from '../../graphql/types.mjs';
|
|
4
4
|
import { InitRoutesOptions } from './types.mjs';
|
|
5
|
+
export { checkAuthStatus } from './token.mjs';
|
|
5
6
|
import '../types.mjs';
|
|
6
7
|
|
|
7
8
|
declare function getEmailAuthRoutes(options: InitRoutesOptions): {
|
|
@@ -2,6 +2,7 @@ import * as next_server from 'next/server';
|
|
|
2
2
|
import { NextRequest } from 'next/server';
|
|
3
3
|
import { Context } from '../../graphql/types.js';
|
|
4
4
|
import { InitRoutesOptions } from './types.js';
|
|
5
|
+
export { checkAuthStatus } from './token.js';
|
|
5
6
|
import '../types.js';
|
|
6
7
|
|
|
7
8
|
declare function getEmailAuthRoutes(options: InitRoutesOptions): {
|
|
@@ -57,6 +57,13 @@ function verifyUser(user, password) {
|
|
|
57
57
|
if (!user.password) return false;
|
|
58
58
|
return compare(password, user.password);
|
|
59
59
|
}
|
|
60
|
+
async function checkAuthStatus(redirectUnauthorizedURL) {
|
|
61
|
+
const Cookie = await cookies();
|
|
62
|
+
const isAuthorized = !!Cookie.get(REFRESH_COOKIE_NAME)?.value;
|
|
63
|
+
if (!isAuthorized && redirectUnauthorizedURL)
|
|
64
|
+
return redirect(redirectUnauthorizedURL);
|
|
65
|
+
return isAuthorized;
|
|
66
|
+
}
|
|
60
67
|
|
|
61
68
|
// src/auth/utils/errors.ts
|
|
62
69
|
import { NextResponse as NextResponse2 } from "next/server";
|
|
@@ -137,7 +144,8 @@ var getContext = (keys, req) => {
|
|
|
137
144
|
var getDeleteRoute = (options) => async (req) => {
|
|
138
145
|
if (options.onLogout) {
|
|
139
146
|
const ctx = await getContext(options.keys, req);
|
|
140
|
-
await
|
|
147
|
+
const body = await req.json();
|
|
148
|
+
await options.onLogout?.(ctx.userId, body);
|
|
141
149
|
}
|
|
142
150
|
return getTokenizedResponse(void 0, "");
|
|
143
151
|
};
|
|
@@ -148,7 +156,8 @@ var getGetRoute = (options) => async (req) => {
|
|
|
148
156
|
const userID = getUserIdFromRefreshToken(options.keys.refresh, refresh);
|
|
149
157
|
if (userID) {
|
|
150
158
|
if (options.onRefresh) {
|
|
151
|
-
await
|
|
159
|
+
const body = await req.json();
|
|
160
|
+
await options.onRefresh?.(userID, body);
|
|
152
161
|
}
|
|
153
162
|
return getTokenizedResponse(
|
|
154
163
|
generateAccessToken(userID, options.keys.signing)
|
|
@@ -179,7 +188,7 @@ var getPostRoute = (options) => async (req) => {
|
|
|
179
188
|
});
|
|
180
189
|
if (newUser) {
|
|
181
190
|
if (options.onSignUp) {
|
|
182
|
-
await options.onSignUp?.(newUser.id,
|
|
191
|
+
await options.onSignUp?.(newUser.id, data);
|
|
183
192
|
}
|
|
184
193
|
return getTokenizedResponse(
|
|
185
194
|
generateAccessToken(newUser.id, options.keys.signing),
|
|
@@ -198,7 +207,7 @@ var getPutRoute = (options) => async (req) => {
|
|
|
198
207
|
return handleError(400, "A user does not exist", options.onError);
|
|
199
208
|
if (await verifyUser(user, data.password)) {
|
|
200
209
|
if (options.onLogin) {
|
|
201
|
-
await options.onLogin?.(user.id,
|
|
210
|
+
await options.onLogin?.(user.id, data);
|
|
202
211
|
}
|
|
203
212
|
return getTokenizedResponse(
|
|
204
213
|
generateAccessToken(user.id, options.keys.signing),
|
|
@@ -219,5 +228,6 @@ function getEmailAuthRoutes(options) {
|
|
|
219
228
|
};
|
|
220
229
|
}
|
|
221
230
|
export {
|
|
231
|
+
checkAuthStatus,
|
|
222
232
|
getEmailAuthRoutes
|
|
223
233
|
};
|
|
@@ -102,7 +102,8 @@ var getContext = (keys, req) => {
|
|
|
102
102
|
var getDeleteRoute = (options) => async (req) => {
|
|
103
103
|
if (options.onLogout) {
|
|
104
104
|
const ctx = await getContext(options.keys, req);
|
|
105
|
-
await
|
|
105
|
+
const body = await req.json();
|
|
106
|
+
await options.onLogout?.(ctx.userId, body);
|
|
106
107
|
}
|
|
107
108
|
return getTokenizedResponse(void 0, "");
|
|
108
109
|
};
|
|
@@ -76,7 +76,8 @@ var getContext = (keys, req) => {
|
|
|
76
76
|
var getDeleteRoute = (options) => async (req) => {
|
|
77
77
|
if (options.onLogout) {
|
|
78
78
|
const ctx = await getContext(options.keys, req);
|
|
79
|
-
await
|
|
79
|
+
const body = await req.json();
|
|
80
|
+
await options.onLogout?.(ctx.userId, body);
|
|
80
81
|
}
|
|
81
82
|
return getTokenizedResponse(void 0, "");
|
|
82
83
|
};
|
|
@@ -78,7 +78,8 @@ var getGetRoute = (options) => async (req) => {
|
|
|
78
78
|
const userID = getUserIdFromRefreshToken(options.keys.refresh, refresh);
|
|
79
79
|
if (userID) {
|
|
80
80
|
if (options.onRefresh) {
|
|
81
|
-
await
|
|
81
|
+
const body = await req.json();
|
|
82
|
+
await options.onRefresh?.(userID, body);
|
|
82
83
|
}
|
|
83
84
|
return getTokenizedResponse(
|
|
84
85
|
generateAccessToken(userID, options.keys.signing)
|
|
@@ -52,7 +52,8 @@ var getGetRoute = (options) => async (req) => {
|
|
|
52
52
|
const userID = getUserIdFromRefreshToken(options.keys.refresh, refresh);
|
|
53
53
|
if (userID) {
|
|
54
54
|
if (options.onRefresh) {
|
|
55
|
-
await
|
|
55
|
+
const body = await req.json();
|
|
56
|
+
await options.onRefresh?.(userID, body);
|
|
56
57
|
}
|
|
57
58
|
return getTokenizedResponse(
|
|
58
59
|
generateAccessToken(userID, options.keys.signing)
|
|
@@ -146,7 +146,7 @@ var getPostRoute = (options) => async (req) => {
|
|
|
146
146
|
});
|
|
147
147
|
if (newUser) {
|
|
148
148
|
if (options.onSignUp) {
|
|
149
|
-
await options.onSignUp?.(newUser.id,
|
|
149
|
+
await options.onSignUp?.(newUser.id, data);
|
|
150
150
|
}
|
|
151
151
|
return getTokenizedResponse(
|
|
152
152
|
generateAccessToken(newUser.id, options.keys.signing),
|
|
@@ -122,7 +122,7 @@ var getPostRoute = (options) => async (req) => {
|
|
|
122
122
|
});
|
|
123
123
|
if (newUser) {
|
|
124
124
|
if (options.onSignUp) {
|
|
125
|
-
await options.onSignUp?.(newUser.id,
|
|
125
|
+
await options.onSignUp?.(newUser.id, data);
|
|
126
126
|
}
|
|
127
127
|
return getTokenizedResponse(
|
|
128
128
|
generateAccessToken(newUser.id, options.keys.signing),
|
|
@@ -133,7 +133,7 @@ var getPutRoute = (options) => async (req) => {
|
|
|
133
133
|
return handleError(400, "A user does not exist", options.onError);
|
|
134
134
|
if (await verifyUser(user, data.password)) {
|
|
135
135
|
if (options.onLogin) {
|
|
136
|
-
await options.onLogin?.(user.id,
|
|
136
|
+
await options.onLogin?.(user.id, data);
|
|
137
137
|
}
|
|
138
138
|
return getTokenizedResponse(
|
|
139
139
|
generateAccessToken(user.id, options.keys.signing),
|
|
@@ -107,7 +107,7 @@ var getPutRoute = (options) => async (req) => {
|
|
|
107
107
|
return handleError(400, "A user does not exist", options.onError);
|
|
108
108
|
if (await verifyUser(user, data.password)) {
|
|
109
109
|
if (options.onLogin) {
|
|
110
|
-
await options.onLogin?.(user.id,
|
|
110
|
+
await options.onLogin?.(user.id, data);
|
|
111
111
|
}
|
|
112
112
|
return getTokenizedResponse(
|
|
113
113
|
generateAccessToken(user.id, options.keys.signing),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NextRequest } from 'next/server';
|
|
2
1
|
import { UserOutput, ErrorHandler } from '../types.mjs';
|
|
2
|
+
import 'next/server';
|
|
3
3
|
|
|
4
4
|
type InitRoutesOptions = {
|
|
5
5
|
getUser: (data: any) => Promise<UserOutput | undefined>;
|
|
@@ -7,10 +7,10 @@ type InitRoutesOptions = {
|
|
|
7
7
|
onError?: ErrorHandler;
|
|
8
8
|
keys: AuthKeys;
|
|
9
9
|
turnstileKey?: string;
|
|
10
|
-
onSignUp?: (userId: number | null,
|
|
11
|
-
onLogin?: (userId: number | null,
|
|
12
|
-
onRefresh?: (userId: number | null,
|
|
13
|
-
onLogout?: (userId: number | null,
|
|
10
|
+
onSignUp?: (userId: number | null, body: any) => Promise<void>;
|
|
11
|
+
onLogin?: (userId: number | null, body: any) => Promise<void>;
|
|
12
|
+
onRefresh?: (userId: number | null, body: any) => Promise<void>;
|
|
13
|
+
onLogout?: (userId: number | null, body: any) => Promise<void>;
|
|
14
14
|
};
|
|
15
15
|
interface AuthKeys {
|
|
16
16
|
signing: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NextRequest } from 'next/server';
|
|
2
1
|
import { UserOutput, ErrorHandler } from '../types.js';
|
|
2
|
+
import 'next/server';
|
|
3
3
|
|
|
4
4
|
type InitRoutesOptions = {
|
|
5
5
|
getUser: (data: any) => Promise<UserOutput | undefined>;
|
|
@@ -7,10 +7,10 @@ type InitRoutesOptions = {
|
|
|
7
7
|
onError?: ErrorHandler;
|
|
8
8
|
keys: AuthKeys;
|
|
9
9
|
turnstileKey?: string;
|
|
10
|
-
onSignUp?: (userId: number | null,
|
|
11
|
-
onLogin?: (userId: number | null,
|
|
12
|
-
onRefresh?: (userId: number | null,
|
|
13
|
-
onLogout?: (userId: number | null,
|
|
10
|
+
onSignUp?: (userId: number | null, body: any) => Promise<void>;
|
|
11
|
+
onLogin?: (userId: number | null, body: any) => Promise<void>;
|
|
12
|
+
onRefresh?: (userId: number | null, body: any) => Promise<void>;
|
|
13
|
+
onLogout?: (userId: number | null, body: any) => Promise<void>;
|
|
14
14
|
};
|
|
15
15
|
interface AuthKeys {
|
|
16
16
|
signing: string;
|
package/dist/auth/index.cjs.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/auth/index.ts
|
|
21
21
|
var auth_exports = {};
|
|
22
22
|
__export(auth_exports, {
|
|
23
|
+
checkAuthStatus: () => checkAuthStatus,
|
|
23
24
|
getEmailAuthRoutes: () => getEmailAuthRoutes,
|
|
24
25
|
initGoogleAuth: () => initGoogleAuth,
|
|
25
26
|
initInstagramAuth: () => initInstagramAuth
|
|
@@ -97,6 +98,13 @@ function verifyUser(user, password) {
|
|
|
97
98
|
if (!user.password) return false;
|
|
98
99
|
return (0, import_bcryptjs.compare)(password, user.password);
|
|
99
100
|
}
|
|
101
|
+
async function checkAuthStatus(redirectUnauthorizedURL) {
|
|
102
|
+
const Cookie = await (0, import_headers.cookies)();
|
|
103
|
+
const isAuthorized = !!Cookie.get(REFRESH_COOKIE_NAME)?.value;
|
|
104
|
+
if (!isAuthorized && redirectUnauthorizedURL)
|
|
105
|
+
return (0, import_navigation.redirect)(redirectUnauthorizedURL);
|
|
106
|
+
return isAuthorized;
|
|
107
|
+
}
|
|
100
108
|
|
|
101
109
|
// src/auth/utils/errors.ts
|
|
102
110
|
var import_server2 = require("next/server");
|
|
@@ -177,7 +185,8 @@ var getContext = (keys, req) => {
|
|
|
177
185
|
var getDeleteRoute = (options) => async (req) => {
|
|
178
186
|
if (options.onLogout) {
|
|
179
187
|
const ctx = await getContext(options.keys, req);
|
|
180
|
-
await
|
|
188
|
+
const body = await req.json();
|
|
189
|
+
await options.onLogout?.(ctx.userId, body);
|
|
181
190
|
}
|
|
182
191
|
return getTokenizedResponse(void 0, "");
|
|
183
192
|
};
|
|
@@ -188,7 +197,8 @@ var getGetRoute = (options) => async (req) => {
|
|
|
188
197
|
const userID = getUserIdFromRefreshToken(options.keys.refresh, refresh);
|
|
189
198
|
if (userID) {
|
|
190
199
|
if (options.onRefresh) {
|
|
191
|
-
await
|
|
200
|
+
const body = await req.json();
|
|
201
|
+
await options.onRefresh?.(userID, body);
|
|
192
202
|
}
|
|
193
203
|
return getTokenizedResponse(
|
|
194
204
|
generateAccessToken(userID, options.keys.signing)
|
|
@@ -219,7 +229,7 @@ var getPostRoute = (options) => async (req) => {
|
|
|
219
229
|
});
|
|
220
230
|
if (newUser) {
|
|
221
231
|
if (options.onSignUp) {
|
|
222
|
-
await options.onSignUp?.(newUser.id,
|
|
232
|
+
await options.onSignUp?.(newUser.id, data);
|
|
223
233
|
}
|
|
224
234
|
return getTokenizedResponse(
|
|
225
235
|
generateAccessToken(newUser.id, options.keys.signing),
|
|
@@ -238,7 +248,7 @@ var getPutRoute = (options) => async (req) => {
|
|
|
238
248
|
return handleError(400, "A user does not exist", options.onError);
|
|
239
249
|
if (await verifyUser(user, data.password)) {
|
|
240
250
|
if (options.onLogin) {
|
|
241
|
-
await options.onLogin?.(user.id,
|
|
251
|
+
await options.onLogin?.(user.id, data);
|
|
242
252
|
}
|
|
243
253
|
return getTokenizedResponse(
|
|
244
254
|
generateAccessToken(user.id, options.keys.signing),
|
|
@@ -453,6 +463,7 @@ function initInstagramAuth(props) {
|
|
|
453
463
|
}
|
|
454
464
|
// Annotate the CommonJS export names for ESM import in node:
|
|
455
465
|
0 && (module.exports = {
|
|
466
|
+
checkAuthStatus,
|
|
456
467
|
getEmailAuthRoutes,
|
|
457
468
|
initGoogleAuth,
|
|
458
469
|
initInstagramAuth
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { getEmailAuthRoutes } from './email/index.mjs';
|
|
2
2
|
export { initGoogleAuth } from './google/index.mjs';
|
|
3
3
|
export { initInstagramAuth } from './instagram/index.mjs';
|
|
4
|
+
export { checkAuthStatus } from './email/token.mjs';
|
|
4
5
|
import 'next/server';
|
|
5
6
|
import '../graphql/types.mjs';
|
|
6
7
|
import './email/types.mjs';
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { getEmailAuthRoutes } from './email/index.js';
|
|
2
2
|
export { initGoogleAuth } from './google/index.js';
|
|
3
3
|
export { initInstagramAuth } from './instagram/index.js';
|
|
4
|
+
export { checkAuthStatus } from './email/token.js';
|
|
4
5
|
import 'next/server';
|
|
5
6
|
import '../graphql/types.js';
|
|
6
7
|
import './email/types.js';
|
package/dist/auth/index.esm.js
CHANGED
|
@@ -69,6 +69,13 @@ function verifyUser(user, password) {
|
|
|
69
69
|
if (!user.password) return false;
|
|
70
70
|
return compare(password, user.password);
|
|
71
71
|
}
|
|
72
|
+
async function checkAuthStatus(redirectUnauthorizedURL) {
|
|
73
|
+
const Cookie = await cookies();
|
|
74
|
+
const isAuthorized = !!Cookie.get(REFRESH_COOKIE_NAME)?.value;
|
|
75
|
+
if (!isAuthorized && redirectUnauthorizedURL)
|
|
76
|
+
return redirect(redirectUnauthorizedURL);
|
|
77
|
+
return isAuthorized;
|
|
78
|
+
}
|
|
72
79
|
|
|
73
80
|
// src/auth/utils/errors.ts
|
|
74
81
|
import { NextResponse as NextResponse2 } from "next/server";
|
|
@@ -149,7 +156,8 @@ var getContext = (keys, req) => {
|
|
|
149
156
|
var getDeleteRoute = (options) => async (req) => {
|
|
150
157
|
if (options.onLogout) {
|
|
151
158
|
const ctx = await getContext(options.keys, req);
|
|
152
|
-
await
|
|
159
|
+
const body = await req.json();
|
|
160
|
+
await options.onLogout?.(ctx.userId, body);
|
|
153
161
|
}
|
|
154
162
|
return getTokenizedResponse(void 0, "");
|
|
155
163
|
};
|
|
@@ -160,7 +168,8 @@ var getGetRoute = (options) => async (req) => {
|
|
|
160
168
|
const userID = getUserIdFromRefreshToken(options.keys.refresh, refresh);
|
|
161
169
|
if (userID) {
|
|
162
170
|
if (options.onRefresh) {
|
|
163
|
-
await
|
|
171
|
+
const body = await req.json();
|
|
172
|
+
await options.onRefresh?.(userID, body);
|
|
164
173
|
}
|
|
165
174
|
return getTokenizedResponse(
|
|
166
175
|
generateAccessToken(userID, options.keys.signing)
|
|
@@ -191,7 +200,7 @@ var getPostRoute = (options) => async (req) => {
|
|
|
191
200
|
});
|
|
192
201
|
if (newUser) {
|
|
193
202
|
if (options.onSignUp) {
|
|
194
|
-
await options.onSignUp?.(newUser.id,
|
|
203
|
+
await options.onSignUp?.(newUser.id, data);
|
|
195
204
|
}
|
|
196
205
|
return getTokenizedResponse(
|
|
197
206
|
generateAccessToken(newUser.id, options.keys.signing),
|
|
@@ -210,7 +219,7 @@ var getPutRoute = (options) => async (req) => {
|
|
|
210
219
|
return handleError(400, "A user does not exist", options.onError);
|
|
211
220
|
if (await verifyUser(user, data.password)) {
|
|
212
221
|
if (options.onLogin) {
|
|
213
|
-
await options.onLogin?.(user.id,
|
|
222
|
+
await options.onLogin?.(user.id, data);
|
|
214
223
|
}
|
|
215
224
|
return getTokenizedResponse(
|
|
216
225
|
generateAccessToken(user.id, options.keys.signing),
|
|
@@ -424,6 +433,7 @@ function initInstagramAuth(props) {
|
|
|
424
433
|
};
|
|
425
434
|
}
|
|
426
435
|
export {
|
|
436
|
+
checkAuthStatus,
|
|
427
437
|
getEmailAuthRoutes,
|
|
428
438
|
initGoogleAuth,
|
|
429
439
|
initInstagramAuth
|