propro-utils 1.3.9 → 1.3.10
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 +2 -2
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -23,7 +23,7 @@ function proproAuthMiddleware(options = {}) {
|
|
|
23
23
|
let token;
|
|
24
24
|
if (req.headers.authorization?.startsWith("Bearer ")) {
|
|
25
25
|
token = req.headers.authorization.split(" ")[1];
|
|
26
|
-
}
|
|
26
|
+
} else if (req.cookies && req.cookies['x-access-token']) {
|
|
27
27
|
// If not present in Authorization header, try to get it from cookies
|
|
28
28
|
token = req.cookies['x-access-token'];
|
|
29
29
|
}
|
|
@@ -32,7 +32,7 @@ function proproAuthMiddleware(options = {}) {
|
|
|
32
32
|
const verifiedToken = verifyJWT(token, secret);
|
|
33
33
|
if (verifiedToken) {
|
|
34
34
|
req.account = verifiedToken;
|
|
35
|
-
} else {
|
|
35
|
+
} else if (req.cookies && req.cookies['x-refresh-token']) {
|
|
36
36
|
// If token is invalid or expired, try to refresh it
|
|
37
37
|
const refreshToken = req.cookies['x-refresh-token'];
|
|
38
38
|
if (refreshToken) {
|