propro-utils 1.4.27 → 1.4.29
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 +1 -1
- package/src/server/index.js +10 -6
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -81,6 +81,9 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
81
81
|
}
|
|
82
82
|
);
|
|
83
83
|
|
|
84
|
+
const accessMaxAge =
|
|
85
|
+
new Date(access.expires).getTime() - currentDateTime.getTime();
|
|
86
|
+
|
|
84
87
|
const { account, access, refresh } = response.data;
|
|
85
88
|
|
|
86
89
|
if (!account || !access || !refresh) {
|
|
@@ -100,9 +103,6 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
100
103
|
maxAge: refreshMaxAge,
|
|
101
104
|
});
|
|
102
105
|
|
|
103
|
-
const accessMaxAge =
|
|
104
|
-
new Date(access.expires).getTime() - currentDateTime.getTime();
|
|
105
|
-
|
|
106
106
|
res.cookie('x-access-token', access.token, {
|
|
107
107
|
httpOnly: true,
|
|
108
108
|
secure: process.env.NODE_ENV === 'production',
|
|
@@ -148,12 +148,16 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
148
148
|
res.cookie('x-access-token', tokens.access.token, {
|
|
149
149
|
httpOnly: true,
|
|
150
150
|
secure: process.env.NODE_ENV === 'production',
|
|
151
|
-
|
|
151
|
+
expires: accessMaxAge,
|
|
152
152
|
});
|
|
153
153
|
|
|
154
|
-
res.cookie('user', JSON.stringify(user)
|
|
154
|
+
res.cookie('user', JSON.stringify(user), {
|
|
155
|
+
expires: accessMaxAge,
|
|
156
|
+
});
|
|
155
157
|
|
|
156
|
-
res.cookie('account', JSON.stringify(account)
|
|
158
|
+
res.cookie('account', JSON.stringify(account), {
|
|
159
|
+
expires: accessMaxAge,
|
|
160
|
+
});
|
|
157
161
|
|
|
158
162
|
const urlToRedirect = formatRedirectUrl(redirectUrl);
|
|
159
163
|
|