propro-utils 1.7.5 → 1.7.6

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.7.5",
3
+ "version": "1.7.6",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -159,29 +159,38 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
159
159
  try {
160
160
  Object.entries({ ...httpOnlyCookies, ...regularCookies }).forEach(
161
161
  ([name, config]) => {
162
- res.cookie(name, config.value, {
163
- ...commonAttributes,
164
- ...config,
165
- });
162
+ try{
163
+ res.cookie(name, config.value, {
164
+ ...commonAttributes,
165
+ ...config,
166
+ });
167
+ } catch (error) {
168
+ console.error('Error setting cookie: Object.entries', {
169
+ error: error.message,
170
+ stack: error.stack,
171
+ });
172
+ }
166
173
  }
167
174
  );
168
175
 
169
- // const extensionCookiePromises = Object.entries({
170
- // ...httpOnlyCookies,
171
- // ...regularCookies,
172
- // }).map(([name, config]) => {
173
- // return res.cookie(name,config.value, {
174
- // url: `https://${domain || 'propro.so'}`,
175
- // secure: true,
176
- // httpOnly: !!config.httpOnly,
177
- // sameSite: 'None',
178
- // path: '/',
179
- // expirationDate: Math.floor((Date.now() + config.maxAge) / 1000),
180
- // domain: domain?.startsWith('.') ? domain : `.${domain || 'propro.so'}`,
181
- // });
182
- // });
176
+ const extensionCookiePromises = Object.entries({
177
+ ...httpOnlyCookies,
178
+ ...regularCookies,
179
+ }).map(([name, config]) => {
180
+ return setChromeExtensionCookie({
181
+ url: `https://${domain || 'propro.so'}`,
182
+ name,
183
+ value: config.value,
184
+ secure: true,
185
+ httpOnly: !!config.httpOnly,
186
+ sameSite: 'no_restriction',
187
+ path: '/',
188
+ expirationDate: Math.floor((Date.now() + config.maxAge) / 1000),
189
+ domain: domain?.startsWith('.') ? domain : `.${domain || 'propro.so'}`,
190
+ });
191
+ });
183
192
 
184
- // await Promise.allSettled(extensionCookiePromises);
193
+ await Promise.allSettled(extensionCookiePromises);
185
194
 
186
195
  console.log('Auth cookies set successfully', {
187
196
  domain,