propro-utils 1.4.50 → 1.4.51
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
|
@@ -11,30 +11,36 @@ const setAuthCookies = (res, tokens, account, user) => {
|
|
|
11
11
|
|
|
12
12
|
const refreshMaxAge =
|
|
13
13
|
new Date(tokens.refresh.expires).getTime() - currentDateTime.getTime();
|
|
14
|
+
const accessMaxAge =
|
|
15
|
+
new Date(tokens.access.expires).getTime() - currentDateTime.getTime();
|
|
16
|
+
|
|
17
|
+
const commonAttributes = {
|
|
18
|
+
secure: process.env.NODE_ENV === 'production',
|
|
19
|
+
sameSite: 'Strict',
|
|
20
|
+
path: '/',
|
|
21
|
+
domain: 'app.mapmap.app',
|
|
22
|
+
};
|
|
14
23
|
|
|
15
24
|
res.cookie('x-refresh-token', tokens.refresh.token, {
|
|
16
25
|
httpOnly: true,
|
|
17
|
-
secure: process.env.NODE_ENV === 'production',
|
|
18
26
|
maxAge: refreshMaxAge,
|
|
27
|
+
...commonAttributes,
|
|
19
28
|
});
|
|
20
29
|
|
|
21
|
-
const accessMaxAge =
|
|
22
|
-
new Date(tokens.access.expires).getTime() - currentDateTime.getTime();
|
|
23
|
-
|
|
24
30
|
res.cookie('x-access-token', tokens.access.token, {
|
|
25
31
|
httpOnly: true,
|
|
26
|
-
secure: process.env.NODE_ENV === 'production',
|
|
27
32
|
maxAge: accessMaxAge,
|
|
33
|
+
...commonAttributes,
|
|
28
34
|
});
|
|
29
35
|
|
|
30
36
|
res.cookie('user', JSON.stringify(user), {
|
|
31
37
|
maxAge: refreshMaxAge,
|
|
32
|
-
|
|
38
|
+
...commonAttributes,
|
|
33
39
|
});
|
|
34
40
|
|
|
35
41
|
res.cookie('account', JSON.stringify(account), {
|
|
36
42
|
maxAge: refreshMaxAge,
|
|
37
|
-
|
|
43
|
+
...commonAttributes,
|
|
38
44
|
});
|
|
39
45
|
|
|
40
46
|
res.cookie(
|
|
@@ -42,7 +48,7 @@ const setAuthCookies = (res, tokens, account, user) => {
|
|
|
42
48
|
JSON.stringify({ value: 'true', expires: accessMaxAge }),
|
|
43
49
|
{
|
|
44
50
|
maxAge: accessMaxAge,
|
|
45
|
-
|
|
51
|
+
...commonAttributes,
|
|
46
52
|
}
|
|
47
53
|
);
|
|
48
54
|
};
|