TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/elysiajs/documentation/llms.txt
Use this file to discover all available pages before exploring further.
@elysia/bearer plugin extracts Bearer tokens from incoming Authorization headers as defined in RFC6750. It makes the token available in your handler context as bearer, leaving all validation logic up to you.
Installation
Basic usage
bearer value in the context is the raw token string extracted from the Authorization: Bearer <token> header, or undefined if no bearer token is present.
This plugin only extracts the token. It does not validate it. Use it alongside
@elysia/jwt or your own verification logic to authenticate requests.Combining with JWT validation
The bearer plugin pairs naturally with the JWT plugin. Usebearer to extract the token and jwt.verify() to validate it: