propro-utils 1.4.93 → 1.4.95
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 +1 -1
- package/src/server/index.js +11 -3
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -207,7 +207,8 @@ class AuthMiddleware {
|
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
handleLogout = async (req, res) => {
|
|
210
|
-
const refreshToken =
|
|
210
|
+
const refreshToken =
|
|
211
|
+
req.cookies['x-refresh-token'] || req.headers['x-refresh-token'];
|
|
211
212
|
if (!refreshToken) {
|
|
212
213
|
return res.status(401).json({ error: 'No refresh token provided' });
|
|
213
214
|
}
|
|
@@ -332,10 +333,17 @@ class AuthMiddleware {
|
|
|
332
333
|
headers.Authorization = `Bearer ${accessToken}`;
|
|
333
334
|
}
|
|
334
335
|
|
|
335
|
-
|
|
336
|
+
let formattedAuthUrl = formatRedirectUrl(this.options.authUrl);
|
|
337
|
+
|
|
338
|
+
if (!accessToken) {
|
|
339
|
+
formattedAuthUrl = `${formattedAuthUrl}&clientId=${this.options.clientId}&redirectUri=${this.options.redirectUri}`;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
console.log('formattedAuthUrl:', formattedAuthUrl);
|
|
343
|
+
console.log('req.method:', req.method);
|
|
336
344
|
return axios({
|
|
337
345
|
method: req.method,
|
|
338
|
-
url: `${formattedAuthUrl}${path}
|
|
346
|
+
url: `${formattedAuthUrl}${path}`,
|
|
339
347
|
data: req.body,
|
|
340
348
|
headers: headers,
|
|
341
349
|
});
|