@technomoron/api-server-base 1.1.10 → 1.1.11
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.
|
@@ -601,15 +601,14 @@ class ApiServer {
|
|
|
601
601
|
if (authHeader?.startsWith('Bearer ')) {
|
|
602
602
|
token = authHeader.slice(7).trim();
|
|
603
603
|
}
|
|
604
|
-
|
|
605
|
-
throw new ApiError({ code: 401, message: 'Authorization header is missing or invalid' });
|
|
606
|
-
}
|
|
607
|
-
if (!token || token === null) {
|
|
604
|
+
if (!token) {
|
|
608
605
|
const access = apiReq.req.cookies?.dat;
|
|
609
606
|
if (access) {
|
|
610
607
|
token = access;
|
|
611
608
|
}
|
|
612
|
-
|
|
609
|
+
}
|
|
610
|
+
if (!token || token === null) {
|
|
611
|
+
if (requiresAuthToken) {
|
|
613
612
|
throw new ApiError({ code: 401, message: 'Authorization token is required (Bearer/cookie)' });
|
|
614
613
|
}
|
|
615
614
|
}
|
|
@@ -593,15 +593,14 @@ export class ApiServer {
|
|
|
593
593
|
if (authHeader?.startsWith('Bearer ')) {
|
|
594
594
|
token = authHeader.slice(7).trim();
|
|
595
595
|
}
|
|
596
|
-
|
|
597
|
-
throw new ApiError({ code: 401, message: 'Authorization header is missing or invalid' });
|
|
598
|
-
}
|
|
599
|
-
if (!token || token === null) {
|
|
596
|
+
if (!token) {
|
|
600
597
|
const access = apiReq.req.cookies?.dat;
|
|
601
598
|
if (access) {
|
|
602
599
|
token = access;
|
|
603
600
|
}
|
|
604
|
-
|
|
601
|
+
}
|
|
602
|
+
if (!token || token === null) {
|
|
603
|
+
if (requiresAuthToken) {
|
|
605
604
|
throw new ApiError({ code: 401, message: 'Authorization token is required (Bearer/cookie)' });
|
|
606
605
|
}
|
|
607
606
|
}
|