propro-utils 1.7.24 → 1.7.25
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
package/src/server/index.js
CHANGED
|
@@ -168,7 +168,7 @@ class AuthMiddleware {
|
|
|
168
168
|
|
|
169
169
|
await setAuthCookies(res, tokens, account, user, this.options.appUrl);
|
|
170
170
|
|
|
171
|
-
res.redirect(formatRedirectUrl(this.options.
|
|
171
|
+
res.redirect(formatRedirectUrl(this.options.appUrl));
|
|
172
172
|
} catch (error) {
|
|
173
173
|
console.error('Error in callback:', error);
|
|
174
174
|
res.status(500).send('Internal Server Error');
|
|
@@ -101,7 +101,9 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
101
101
|
// Domain configuration
|
|
102
102
|
let domain;
|
|
103
103
|
try {
|
|
104
|
+
console.log('** APP URL', appUrl)
|
|
104
105
|
domain = appUrl ? new URL(appUrl).hostname : undefined;
|
|
106
|
+
console.log('** DOMAIN', domain)
|
|
105
107
|
if (domain?.includes('mapmap.app')) {
|
|
106
108
|
domain = '.mapmap.app';
|
|
107
109
|
}
|
|
@@ -112,6 +114,7 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
112
114
|
domain = 'propro.so';
|
|
113
115
|
}
|
|
114
116
|
} catch (error) {
|
|
117
|
+
console.log('** ERROR', error)
|
|
115
118
|
console.error('Invalid appUrl:', { error, appUrl });
|
|
116
119
|
domain = undefined;
|
|
117
120
|
}
|
|
@@ -123,6 +126,10 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
123
126
|
path: '/',
|
|
124
127
|
};
|
|
125
128
|
|
|
129
|
+
console.log('** MAX AGES', {
|
|
130
|
+
refreshMaxAge,
|
|
131
|
+
accessMaxAge
|
|
132
|
+
})
|
|
126
133
|
const httpOnlyCookies = {
|
|
127
134
|
'x-refresh-token': {
|
|
128
135
|
value: tokens.refresh.token,
|
|
@@ -138,7 +145,7 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
138
145
|
|
|
139
146
|
const sanitizedUser = sanitizeUser(user);
|
|
140
147
|
const sanitizedAccount = { ...account };
|
|
141
|
-
delete sanitizedAccount
|
|
148
|
+
delete sanitizedAccount?.passwordHistory;
|
|
142
149
|
|
|
143
150
|
const regularCookies = {
|
|
144
151
|
user: {
|
|
@@ -155,6 +162,11 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
155
162
|
},
|
|
156
163
|
};
|
|
157
164
|
|
|
165
|
+
console.log('** SURVIVED OBJECTIFYING COOKIES', {
|
|
166
|
+
httpOnlyCookies,
|
|
167
|
+
regularCookies,
|
|
168
|
+
})
|
|
169
|
+
|
|
158
170
|
try {
|
|
159
171
|
Object.entries({ ...httpOnlyCookies, ...regularCookies }).forEach(
|
|
160
172
|
([name, config]) => {
|
|
@@ -165,6 +177,7 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
165
177
|
}
|
|
166
178
|
);
|
|
167
179
|
|
|
180
|
+
/*
|
|
168
181
|
const extensionCookiePromises = Object.entries({
|
|
169
182
|
...httpOnlyCookies,
|
|
170
183
|
...regularCookies,
|
|
@@ -183,6 +196,7 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
|
|
|
183
196
|
});
|
|
184
197
|
|
|
185
198
|
await Promise.allSettled(extensionCookiePromises);
|
|
199
|
+
*/
|
|
186
200
|
|
|
187
201
|
console.log('Auth cookies set successfully', {
|
|
188
202
|
domain,
|