propro-utils 1.4.43 → 1.4.44
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 +3 -9
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -56,6 +56,7 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
56
56
|
if (req.cookies) {
|
|
57
57
|
refreshToken = req.cookies['x-refresh-token'];
|
|
58
58
|
}
|
|
59
|
+
console.log('refreshing tokens: ', refreshToken);
|
|
59
60
|
if (!refreshToken) {
|
|
60
61
|
const redirectUrl = constructRedirectUrl(
|
|
61
62
|
clientUrl,
|
|
@@ -85,7 +86,7 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
85
86
|
}
|
|
86
87
|
);
|
|
87
88
|
} catch (error) {
|
|
88
|
-
console.error('an error occur: ', error);
|
|
89
|
+
console.error('an error occur: ', error.message);
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
const { account, access, refresh } = response.data;
|
|
@@ -128,6 +129,7 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
128
129
|
return res.redirect(urlToRedirect);
|
|
129
130
|
}
|
|
130
131
|
} catch (error) {
|
|
132
|
+
console.log('Unauthorized: ', error.message);
|
|
131
133
|
res.status(401).send('Unauthorized: Invalid or expired token');
|
|
132
134
|
}
|
|
133
135
|
};
|
|
@@ -143,14 +145,6 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
143
145
|
* @return {string} The constructed redirect URL.
|
|
144
146
|
*/
|
|
145
147
|
function constructRedirectUrl(clientUrl, appName, clientId, redirectUri) {
|
|
146
|
-
console.log(
|
|
147
|
-
'constructRedirectUrl',
|
|
148
|
-
clientUrl,
|
|
149
|
-
appName,
|
|
150
|
-
clientId,
|
|
151
|
-
redirectUri
|
|
152
|
-
);
|
|
153
|
-
|
|
154
148
|
const urlToRedirect = formatRedirectUrl(clientUrl);
|
|
155
149
|
|
|
156
150
|
return `${urlToRedirect}/signin?response_type=code&appName=${appName}&client_id=${clientId}&redirect_uri=${encodeURIComponent(
|