mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Cleanup missing auth header error
This commit is contained in:
parent
8592191808
commit
c5d05d69aa
@ -37,7 +37,7 @@ export const auth = new Elysia({ name: "auth" })
|
|||||||
.guard({
|
.guard({
|
||||||
headers: t.Object(
|
headers: t.Object(
|
||||||
{
|
{
|
||||||
authorization: t.TemplateLiteral("Bearer ${string}"),
|
authorization: t.Optional(t.TemplateLiteral("Bearer ${string}")),
|
||||||
},
|
},
|
||||||
{ additionalProperties: true },
|
{ additionalProperties: true },
|
||||||
),
|
),
|
||||||
@ -45,9 +45,9 @@ export const auth = new Elysia({ name: "auth" })
|
|||||||
.resolve(async ({ headers: { authorization }, status }) => {
|
.resolve(async ({ headers: { authorization }, status }) => {
|
||||||
const bearer = authorization?.slice(7);
|
const bearer = authorization?.slice(7);
|
||||||
if (!bearer) {
|
if (!bearer) {
|
||||||
return status(500, {
|
return status(403, {
|
||||||
status: 500,
|
status: 403,
|
||||||
message: "No jwt, auth server configuration error.",
|
message: "No authorization header was found.",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user