propro-utils 1.4.3 → 1.4.4
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 +13 -3
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -30,6 +30,7 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
30
30
|
|
|
31
31
|
return async (req, res, next) => {
|
|
32
32
|
console.log('proproAuthMiddleware');
|
|
33
|
+
let refreshToken;
|
|
33
34
|
try {
|
|
34
35
|
if (
|
|
35
36
|
!['/api/auth', '/api/callback', '/api/refreshToken'].includes(req.path)
|
|
@@ -45,9 +46,9 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
45
46
|
|
|
46
47
|
if (req.path === '/api/refreshToken') {
|
|
47
48
|
console.log('refreshToken');
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
try {
|
|
50
|
+
refreshToken = req.cookies['x-refresh-token'];
|
|
51
|
+
} catch (error) {
|
|
51
52
|
console.log('No refresh token provided');
|
|
52
53
|
const redirectUrl = constructRedirectUrl(clientUrl, appName, clientId, redirectUri);
|
|
53
54
|
console.log('redirectUrl', redirectUrl);
|
|
@@ -55,6 +56,15 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
55
56
|
.status(401)
|
|
56
57
|
.json({redirectUrl, error: 'No refresh token provided'});
|
|
57
58
|
}
|
|
59
|
+
// console.log('getting refreshToken', refreshToken);
|
|
60
|
+
// if (!refreshToken) {
|
|
61
|
+
// console.log('No refresh token provided');
|
|
62
|
+
// const redirectUrl = constructRedirectUrl(clientUrl, appName, clientId, redirectUri);
|
|
63
|
+
// console.log('redirectUrl', redirectUrl);
|
|
64
|
+
// res
|
|
65
|
+
// .status(401)
|
|
66
|
+
// .json({redirectUrl, error: 'No refresh token provided'});
|
|
67
|
+
// }
|
|
58
68
|
|
|
59
69
|
const response = await post(
|
|
60
70
|
`${authUrl}/api/v1/auth/refreshTokens`,
|