@ccci/micro-server 1.0.93 → 1.0.95
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/dist/index.js +2 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -113667,10 +113667,8 @@ function generate(payload) {
|
|
|
113667
113667
|
return import_jsonwebtoken.default.sign(payload, SECRET_KEY, { expiresIn: EXPIRY, issuer: ISSUER });
|
|
113668
113668
|
}
|
|
113669
113669
|
function verify(token) {
|
|
113670
|
+
console.log("process.env.JWT_SECRET_KEY :>> ", process.env.JWT_SECRET_KEY);
|
|
113670
113671
|
let decoded = import_jsonwebtoken.default.verify(token, SECRET_KEY);
|
|
113671
|
-
if (decoded.iss !== ISSUER) {
|
|
113672
|
-
throw new Error("Token Issuer is not valid");
|
|
113673
|
-
}
|
|
113674
113672
|
return decoded;
|
|
113675
113673
|
}
|
|
113676
113674
|
function decode(val2) {
|
|
@@ -113725,6 +113723,7 @@ class RouterFactory {
|
|
|
113725
113723
|
if (bearerToken && bearerToken != null && bearerToken != "null") {
|
|
113726
113724
|
const token = bearerToken.split(" ")[1];
|
|
113727
113725
|
let decoded = verify(token);
|
|
113726
|
+
req.user = decoded;
|
|
113728
113727
|
} else if (!grantPublicAccess)
|
|
113729
113728
|
return res.status(401).send({ success: false, error: 1004, errorMessage: "Unauthorized. No access token found on the request." });
|
|
113730
113729
|
next();
|