propro-utils 1.6.8 → 1.6.9

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.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -124,12 +124,8 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
124
124
  isSecureConnection = false;
125
125
  }
126
126
  if (domain?.includes("propro.so")) {
127
- // Handle both main domain and subdomains of propro.so
128
- if (domain.startsWith("short.")) {
129
- domain = ".short.propro.so";
130
- } else {
131
- domain = ".propro.so";
132
- }
127
+ // Always set cookies on the root domain for all propro.so subdomains
128
+ domain = ".propro.so";
133
129
  }
134
130
 
135
131
  console.log("Cookie configuration:", {
@@ -138,6 +134,7 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
138
134
  protocol: urlObj.protocol,
139
135
  originalUrl: appUrl,
140
136
  processedUrl: processedAppUrl,
137
+ hostname: urlObj.hostname,
141
138
  });
142
139
  } catch (error) {
143
140
  console.error("Invalid appUrl:", { error, appUrl });
@@ -155,7 +152,7 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
155
152
  domain,
156
153
  path: "/",
157
154
  httpOnly: false,
158
- expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000),
155
+ expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000), // 1 year expiry as fallback
159
156
  };
160
157
 
161
158
  console.log("Cookie attributes:", commonAttributes);
@@ -275,12 +272,8 @@ const clearAuthCookies = async (res, appUrl) => {
275
272
  isSecureConnection = false;
276
273
  }
277
274
  if (domain?.includes("propro.so")) {
278
- // Handle both main domain and subdomains of propro.so
279
- if (domain.startsWith("short.")) {
280
- domain = "short.propro.so";
281
- } else {
282
- domain = "propro.so";
283
- }
275
+ // Always set cookies on the root domain for all propro.so subdomains
276
+ domain = ".propro.so";
284
277
  }
285
278
 
286
279
  console.log("Clear cookies configuration:", {
@@ -289,6 +282,7 @@ const clearAuthCookies = async (res, appUrl) => {
289
282
  protocol: urlObj.protocol,
290
283
  originalUrl: appUrl,
291
284
  processedUrl: processedAppUrl,
285
+ hostname: urlObj.hostname,
292
286
  });
293
287
  } catch (error) {
294
288
  console.error("Invalid appUrl:", error);
@@ -302,7 +296,7 @@ const clearAuthCookies = async (res, appUrl) => {
302
296
  domain,
303
297
  path: "/",
304
298
  httpOnly: false,
305
- expires: new Date(0),
299
+ expires: new Date(0), // Set expiry to past date to ensure cookie is removed
306
300
  };
307
301
 
308
302
  console.log("Clear cookie attributes:", commonAttributes);