@meridianjs/auth 0.1.1 → 0.1.2
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 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -128,11 +128,11 @@ var AuthModuleService = class extends (0, import_framework_utils.MeridianService
|
|
|
128
128
|
var import_jsonwebtoken2 = __toESM(require("jsonwebtoken"));
|
|
129
129
|
function authenticateJWT(req, res, next) {
|
|
130
130
|
const authHeader = req.headers.authorization;
|
|
131
|
-
|
|
131
|
+
const token = authHeader?.startsWith("Bearer ") ? authHeader.substring(7) : req.query?.token;
|
|
132
|
+
if (!token) {
|
|
132
133
|
res.status(401).json({ error: { message: "Unauthorized \u2014 Bearer token required" } });
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
|
-
const token = authHeader.substring(7);
|
|
136
136
|
let config;
|
|
137
137
|
try {
|
|
138
138
|
const scope = req.scope;
|
package/dist/index.mjs
CHANGED
|
@@ -89,11 +89,11 @@ var AuthModuleService = class extends MeridianService({}) {
|
|
|
89
89
|
import jwt2 from "jsonwebtoken";
|
|
90
90
|
function authenticateJWT(req, res, next) {
|
|
91
91
|
const authHeader = req.headers.authorization;
|
|
92
|
-
|
|
92
|
+
const token = authHeader?.startsWith("Bearer ") ? authHeader.substring(7) : req.query?.token;
|
|
93
|
+
if (!token) {
|
|
93
94
|
res.status(401).json({ error: { message: "Unauthorized \u2014 Bearer token required" } });
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
|
-
const token = authHeader.substring(7);
|
|
97
97
|
let config;
|
|
98
98
|
try {
|
|
99
99
|
const scope = req.scope;
|