hapta 1.0.15 → 1.0.17
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/helpers/HTTP/Request/Context.ts +2 -2
- package/index.ts +3 -2
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -500,17 +500,18 @@ async function buildRequestContext(req: Request, headers: Headers): Promise<Cont
|
|
|
500
500
|
const reqJSON = await req.json().catch(() => ({}));
|
|
501
501
|
|
|
502
502
|
const authHeader = headers.get("Authorization");
|
|
503
|
-
const token = authHeader
|
|
503
|
+
const token = authHeader ? authHeader.trim() : null;
|
|
504
504
|
|
|
505
505
|
let isAuthenticated = false;
|
|
506
506
|
let principal: any = { isAuthenticated };
|
|
507
507
|
|
|
508
508
|
if (token) {
|
|
509
509
|
try {
|
|
510
|
-
const validated = jwt.verify(token, config.Server.
|
|
510
|
+
const validated = jwt.verify(token, config.Server.JWT_Secret);
|
|
511
511
|
principal = { ...validated, isAuthenticated: true };
|
|
512
512
|
isAuthenticated = true;
|
|
513
513
|
} catch (error) {
|
|
514
|
+
console.log(error)
|
|
514
515
|
isAuthenticated = false;
|
|
515
516
|
}
|
|
516
517
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"bin": {
|
|
4
4
|
"hapta": "./index.ts"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.17",
|
|
7
7
|
"description": "modular, scalable, and feature-rich backend framework designed to extend Pocketbase with authentication, schema validation, caching, and tenant-based service orchestration.",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"jsonwebtoken": "^9.0.3",
|