feat: add bun-fullstack agent and update skills
This commit is contained in:
30
.agent/skills/tech-stack/elysiajs/plugins/bearer.md
Normal file
30
.agent/skills/tech-stack/elysiajs/plugins/bearer.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Bearer
|
||||
Plugin for Elysia for retrieving the Bearer token.
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
bun add @elysiajs/bearer
|
||||
```
|
||||
|
||||
## Basic Usage
|
||||
```typescript twoslash
|
||||
import { Elysia } from 'elysia'
|
||||
import { bearer } from '@elysiajs/bearer'
|
||||
|
||||
const app = new Elysia()
|
||||
.use(bearer())
|
||||
.get('/sign', ({ bearer }) => bearer, {
|
||||
beforeHandle({ bearer, set, status }) {
|
||||
if (!bearer) {
|
||||
set.headers[
|
||||
'WWW-Authenticate'
|
||||
] = `Bearer realm='sign', error="invalid_request"`
|
||||
|
||||
return status(400, 'Unauthorized')
|
||||
}
|
||||
}
|
||||
})
|
||||
.listen(3000)
|
||||
```
|
||||
|
||||
This plugin is for retrieving a Bearer token specified in RFC6750
|
||||
Reference in New Issue
Block a user