propro-utils 1.4.62 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.4.62",
3
+ "version": "1.4.63",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -125,12 +125,16 @@ function proproAuthMiddleware(options = {}, userSchema) {
125
125
 
126
126
  setAuthCookies(res, tokens, account, user, redirectUrl);
127
127
 
128
- const urlToRedirect = formatRedirectUrl(redirectUrl);
129
-
130
128
  const setCookies = res.getHeader('Set-Cookie');
131
129
  console.log('Set-Cookies: ', setCookies);
132
130
 
133
- return res.redirect(urlToRedirect);
131
+ res.on('finish', () => {
132
+ const urlToRedirect = formatRedirectUrl(redirectUrl);
133
+ console.log('Redirecting to: ', urlToRedirect);
134
+ res.redirect(urlToRedirect);
135
+ });
136
+
137
+ res.end();
134
138
  }
135
139
  } catch (error) {
136
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
- // sameSite: 'Strict',
20
+ sameSite: 'Strict',
21
21
  // path: '/',
22
22
  domain: appUrl ? new URL(appUrl).hostname : undefined,
23
23
  };