propro-utils 1.6.7 → 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
|
@@ -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
|
-
//
|
|
128
|
-
|
|
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 });
|
|
@@ -154,6 +151,8 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
154
151
|
sameSite: isSecureConnection ? "None" : "Lax",
|
|
155
152
|
domain,
|
|
156
153
|
path: "/",
|
|
154
|
+
httpOnly: false,
|
|
155
|
+
expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000), // 1 year expiry as fallback
|
|
157
156
|
};
|
|
158
157
|
|
|
159
158
|
console.log("Cookie attributes:", commonAttributes);
|
|
@@ -163,11 +162,13 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
163
162
|
value: tokens.refresh.token,
|
|
164
163
|
maxAge: refreshMaxAge,
|
|
165
164
|
httpOnly: true,
|
|
165
|
+
secure: isSecureConnection,
|
|
166
166
|
},
|
|
167
167
|
"x-access-token": {
|
|
168
168
|
value: tokens.access.token,
|
|
169
169
|
maxAge: accessMaxAge,
|
|
170
170
|
httpOnly: true,
|
|
171
|
+
secure: isSecureConnection,
|
|
171
172
|
},
|
|
172
173
|
};
|
|
173
174
|
|
|
@@ -179,14 +180,20 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
179
180
|
user: {
|
|
180
181
|
value: safeStringify(sanitizedUser),
|
|
181
182
|
maxAge: refreshMaxAge,
|
|
183
|
+
httpOnly: false,
|
|
184
|
+
secure: isSecureConnection,
|
|
182
185
|
},
|
|
183
186
|
account: {
|
|
184
187
|
value: safeStringify(sanitizedAccount),
|
|
185
188
|
maxAge: refreshMaxAge,
|
|
189
|
+
httpOnly: false,
|
|
190
|
+
secure: isSecureConnection,
|
|
186
191
|
},
|
|
187
192
|
has_account_token: {
|
|
188
193
|
value: JSON.stringify({ value: "true", expires: accessMaxAge }),
|
|
189
194
|
maxAge: accessMaxAge,
|
|
195
|
+
httpOnly: false,
|
|
196
|
+
secure: isSecureConnection,
|
|
190
197
|
},
|
|
191
198
|
};
|
|
192
199
|
|
|
@@ -265,12 +272,8 @@ const clearAuthCookies = async (res, appUrl) => {
|
|
|
265
272
|
isSecureConnection = false;
|
|
266
273
|
}
|
|
267
274
|
if (domain?.includes("propro.so")) {
|
|
268
|
-
//
|
|
269
|
-
|
|
270
|
-
domain = "short.propro.so";
|
|
271
|
-
} else {
|
|
272
|
-
domain = "propro.so";
|
|
273
|
-
}
|
|
275
|
+
// Always set cookies on the root domain for all propro.so subdomains
|
|
276
|
+
domain = ".propro.so";
|
|
274
277
|
}
|
|
275
278
|
|
|
276
279
|
console.log("Clear cookies configuration:", {
|
|
@@ -279,6 +282,7 @@ const clearAuthCookies = async (res, appUrl) => {
|
|
|
279
282
|
protocol: urlObj.protocol,
|
|
280
283
|
originalUrl: appUrl,
|
|
281
284
|
processedUrl: processedAppUrl,
|
|
285
|
+
hostname: urlObj.hostname,
|
|
282
286
|
});
|
|
283
287
|
} catch (error) {
|
|
284
288
|
console.error("Invalid appUrl:", error);
|
|
@@ -291,6 +295,8 @@ const clearAuthCookies = async (res, appUrl) => {
|
|
|
291
295
|
sameSite: isSecureConnection ? "None" : "Lax",
|
|
292
296
|
domain,
|
|
293
297
|
path: "/",
|
|
298
|
+
httpOnly: false,
|
|
299
|
+
expires: new Date(0), // Set expiry to past date to ensure cookie is removed
|
|
294
300
|
};
|
|
295
301
|
|
|
296
302
|
console.log("Clear cookie attributes:", commonAttributes);
|