propro-utils 1.4.45 → 1.4.47
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 +6 -5
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -72,9 +72,6 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
72
72
|
const formatedAuthUrl = formatRedirectUrl(authUrl);
|
|
73
73
|
|
|
74
74
|
let response;
|
|
75
|
-
let account;
|
|
76
|
-
let access;
|
|
77
|
-
let refresh;
|
|
78
75
|
|
|
79
76
|
try {
|
|
80
77
|
response = await post(
|
|
@@ -88,12 +85,12 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
88
85
|
},
|
|
89
86
|
}
|
|
90
87
|
);
|
|
91
|
-
|
|
92
|
-
({ account, access, refresh } = response.data);
|
|
93
88
|
} catch (error) {
|
|
94
89
|
console.error('an error occur: ', error.message);
|
|
95
90
|
}
|
|
96
91
|
|
|
92
|
+
let { account, access, refresh } = response.data;
|
|
93
|
+
|
|
97
94
|
if (!account || !access || !refresh) {
|
|
98
95
|
return res
|
|
99
96
|
.status(401)
|
|
@@ -124,9 +121,13 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
124
121
|
);
|
|
125
122
|
|
|
126
123
|
const user = await checkIfUserExists(userSchema, account.accountId);
|
|
124
|
+
console.log('user: ', user);
|
|
127
125
|
|
|
126
|
+
console.log('setting cookies: ', tokens, account, user);
|
|
128
127
|
setAuthCookies(res, tokens, account, user);
|
|
129
128
|
|
|
129
|
+
console.log('setting cookies and redirectUrl: ', redirectUrl);
|
|
130
|
+
|
|
130
131
|
const urlToRedirect = formatRedirectUrl(redirectUrl);
|
|
131
132
|
|
|
132
133
|
return res.redirect(urlToRedirect);
|