propro-utils 1.4.61 → 1.4.63
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
CHANGED
package/src/server/index.js
CHANGED
|
@@ -125,33 +125,16 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
125
125
|
|
|
126
126
|
setAuthCookies(res, tokens, account, user, redirectUrl);
|
|
127
127
|
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
console.log('Cookies set successfully', JSON.stringify(res.cookie));
|
|
131
|
-
const cookie = res.cookie;
|
|
132
|
-
console.log('Cookies set successfully', JSON.stringify(cookie));
|
|
133
|
-
console.log('Cookies set successfully', JSON.stringify(cookie['user']));
|
|
134
|
-
console.log(
|
|
135
|
-
'Cookies set successfully',
|
|
136
|
-
JSON.stringify(cookie['account'])
|
|
137
|
-
);
|
|
138
|
-
console.log(
|
|
139
|
-
'Cookies set successfully',
|
|
140
|
-
JSON.stringify(cookie['x-refresh-token'])
|
|
141
|
-
);
|
|
142
|
-
console.log(
|
|
143
|
-
'Cookies set successfully',
|
|
144
|
-
JSON.stringify(cookie['x-access-token'])
|
|
145
|
-
);
|
|
146
|
-
console.log(
|
|
147
|
-
'Cookies set successfully',
|
|
148
|
-
JSON.stringify(cookie['has_account_token'])
|
|
149
|
-
);
|
|
128
|
+
const setCookies = res.getHeader('Set-Cookie');
|
|
129
|
+
console.log('Set-Cookies: ', setCookies);
|
|
150
130
|
|
|
151
|
-
|
|
152
|
-
|
|
131
|
+
res.on('finish', () => {
|
|
132
|
+
const urlToRedirect = formatRedirectUrl(redirectUrl);
|
|
133
|
+
console.log('Redirecting to: ', urlToRedirect);
|
|
134
|
+
res.redirect(urlToRedirect);
|
|
135
|
+
});
|
|
153
136
|
|
|
154
|
-
|
|
137
|
+
res.end();
|
|
155
138
|
}
|
|
156
139
|
} catch (error) {
|
|
157
140
|
console.log('Unauthorized: ', error.message);
|
|
@@ -17,7 +17,7 @@ const setAuthCookies = (res, tokens, account, user, appUrl) => {
|
|
|
17
17
|
|
|
18
18
|
const commonAttributes = {
|
|
19
19
|
secure: process.env.NODE_ENV === 'production',
|
|
20
|
-
|
|
20
|
+
sameSite: 'Strict',
|
|
21
21
|
// path: '/',
|
|
22
22
|
domain: appUrl ? new URL(appUrl).hostname : undefined,
|
|
23
23
|
};
|