Open deanrih opened 8 months ago
The Header Parameter config according to https://elysiajs.com/plugins/jwt.html#config is being stored in the payload section instead of header
for example, when doing
// setup.ts export const JWT = jwt({ name: "jwt", secret: "supersecret", typ: "JWT", }); // main.ts const jwtResult = await jwt.sign({ sub: "subject", });
will result in
eyJhbGciOiJIUzI1NiJ9.eyJ0eXAiOiJKV1QiLCJzdWIiOiJzdWJqZWN0In0.f69kq3ejRaV56IDJOAKDKHlejLU6_MiSiKsa5U4nTIs
{ "alg": "HS256" } { "typ": "JWT", "sub": "subject" }
instead of
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzdWJqZWN0In0.aaT9AYvX_t5IExIkcUJ6Ux38zJcZ89-7q8SNlG5P9dM
{ "alg": "HS256", "typ": "JWT" } { "sub": "subject" }
looking at the code it seems there's no differentiation which is payload and which is header except the alg and crit
alg
crit
https://github.com/elysiajs/elysia-jwt/blob/188b20c92b53c427c087b1dc214ff8635ff046ff/src/index.ts#L136-L144
The Header Parameter config according to https://elysiajs.com/plugins/jwt.html#config is being stored in the payload section instead of header
for example, when doing
will result in
instead of
looking at the code it seems there's no differentiation which is payload and which is header except the
alg
andcrit
https://github.com/elysiajs/elysia-jwt/blob/188b20c92b53c427c087b1dc214ff8635ff046ff/src/index.ts#L136-L144