propro-utils 1.5.21 → 1.5.22
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/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -137,7 +137,7 @@ class AuthMiddleware {
|
|
|
137
137
|
};
|
|
138
138
|
|
|
139
139
|
handleCallback = async (req, res) => {
|
|
140
|
-
const { code
|
|
140
|
+
const { code } = req.query;
|
|
141
141
|
if (!code) {
|
|
142
142
|
return res.status(400).send('No code received');
|
|
143
143
|
}
|
|
@@ -157,13 +157,6 @@ class AuthMiddleware {
|
|
|
157
157
|
throw new Error('User not found');
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
console.log('user:', user);
|
|
161
|
-
console.log('account:', account);
|
|
162
|
-
console.log('tokens:', tokens);
|
|
163
|
-
|
|
164
|
-
if (returnTokens === 'true') {
|
|
165
|
-
return res.status(200).json({ account, user, tokens });
|
|
166
|
-
}
|
|
167
160
|
setAuthCookies(res, tokens, account, user, this.options.appUrl);
|
|
168
161
|
|
|
169
162
|
res.redirect(formatRedirectUrl(this.options.appUrl));
|
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
* @param {string} appUrl - The URL of the client application.
|
|
9
9
|
*/
|
|
10
10
|
const setAuthCookies = (res, tokens, account, user, appUrl) => {
|
|
11
|
+
if (!tokens || !tokens.refresh || !tokens.access) {
|
|
12
|
+
throw new Error('Invalid tokens object');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (!account) {
|
|
16
|
+
throw new Error('Invalid account object');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (!user) {
|
|
20
|
+
throw new Error('Invalid user object');
|
|
21
|
+
}
|
|
11
22
|
const currentDateTime = new Date();
|
|
12
23
|
|
|
13
24
|
const refreshMaxAge =
|