propro-utils 1.4.29 → 1.4.31

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.29",
3
+ "version": "1.4.31",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -128,7 +128,16 @@ function proproAuthMiddleware(options = {}, userSchema) {
128
128
  redirectUri
129
129
  );
130
130
 
131
+ console.log(
132
+ 'tokens',
133
+ tokens,
134
+ 'account',
135
+ account,
136
+ 'redirectUrl',
137
+ redirectUrl
138
+ );
131
139
  const user = await checkIfUserExists(userSchema, account.accountId);
140
+ console.log('user', user);
132
141
 
133
142
  const currentDateTime = new Date();
134
143
 
@@ -148,15 +157,28 @@ function proproAuthMiddleware(options = {}, userSchema) {
148
157
  res.cookie('x-access-token', tokens.access.token, {
149
158
  httpOnly: true,
150
159
  secure: process.env.NODE_ENV === 'production',
151
- expires: accessMaxAge,
160
+ maxAge: accessMaxAge,
152
161
  });
153
162
 
163
+ console.log(
164
+ 'user',
165
+ user,
166
+ 'account',
167
+ account,
168
+ 'redirectUrl',
169
+ redirectUrl
170
+ );
171
+
154
172
  res.cookie('user', JSON.stringify(user), {
155
- expires: accessMaxAge,
173
+ maxAge: accessMaxAge,
156
174
  });
157
175
 
158
176
  res.cookie('account', JSON.stringify(account), {
159
- expires: accessMaxAge,
177
+ maxAge: accessMaxAge,
178
+ });
179
+
180
+ req.cookie('isLoggedIn', true, {
181
+ maxAge: accessMaxAge,
160
182
  });
161
183
 
162
184
  const urlToRedirect = formatRedirectUrl(redirectUrl);