Skip to content

Commit d09cc2f

Browse files
committed
docs(jwk): added fetch options for JWKS retrieval
1 parent 0738949 commit d09cc2f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/middleware/builtin/jwk.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,31 @@ const id_payload = await verifyWithJwks(
9191
)
9292
```
9393

94+
## Configuring JWKS fetch request options
95+
96+
To configure how JWKS is retrieved from `jwks_uri`, pass fetch request options as the second argument of `jwk()`.
97+
98+
This argument is `RequestInit` and is used only for the JWKS fetch request.
99+
100+
```ts
101+
const app = new Hono()
102+
103+
app.use(
104+
'/auth/*',
105+
jwk(
106+
{
107+
jwks_uri: `https://${backendServer}/.well-known/jwks.json`,
108+
alg: ['RS256'],
109+
},
110+
{
111+
headers: {
112+
Authorization: 'Bearer TOKEN',
113+
},
114+
}
115+
)
116+
)
117+
```
118+
94119
## Options
95120

96121
### <Badge type="danger" text="required" /> alg: `AsymmetricAlgorithm[]`

0 commit comments

Comments
 (0)