propro-utils 1.4.39 → 1.4.41
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 +16 -14
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -106,17 +106,23 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
106
106
|
|
|
107
107
|
const formatedAuthUrl = formatRedirectUrl(authUrl);
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
actionType: 'refresh',
|
|
109
|
+
let response;
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
response = await post(
|
|
113
|
+
`${formatedAuthUrl}/api/v1/auth/refreshTokens`,
|
|
114
|
+
{
|
|
115
|
+
refreshToken,
|
|
117
116
|
},
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
{
|
|
118
|
+
params: {
|
|
119
|
+
actionType: 'refresh',
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error('an error occur: ', error);
|
|
125
|
+
}
|
|
120
126
|
|
|
121
127
|
const { account, access, refresh } = response.data;
|
|
122
128
|
|
|
@@ -128,12 +134,8 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
128
134
|
|
|
129
135
|
const user = await checkIfUserExists(userSchema, account.accountId);
|
|
130
136
|
|
|
131
|
-
console.log('Setting Cookies: ', user, account);
|
|
132
|
-
|
|
133
137
|
setAuthCookies(res, { access, refresh }, account, user);
|
|
134
138
|
|
|
135
|
-
console.log('Cookies Set: ');
|
|
136
|
-
|
|
137
139
|
return res
|
|
138
140
|
.status(200)
|
|
139
141
|
.json({ message: 'Token refreshed successfully' });
|