docs: refer to correct object on request for express middleware (#3564)

This commit is contained in:
Julien Zapata Duque 2025-02-12 04:09:13 +01:00 committed by GitHub
parent ba5621bfe5
commit 8ac69f4ab5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -524,7 +524,7 @@ The following options can be passed when creating a new error handler:
### authenticate()
`express.authenticate(...strategies)` allows to protect an Express middleware with an [authentication service](./authentication/service.md) that has [strategies](./authentication/strategy.md) registered that can parse HTTP headers. It will set the authentication information on the `req` object (e.g. `req.user`). The following example protects the `/hello` endpoint with the JWT strategy (so the `Authorization: Bearer <JWT>` header needs to be set) and uses the user email to render the message:
`express.authenticate(...strategies)` allows to protect an Express middleware with an [authentication service](./authentication/service.md) that has [strategies](./authentication/strategy.md) registered that can parse HTTP headers. It will set the authentication information on the `req.feathers` object (e.g. `req.feathers.user`). The following example protects the `/hello` endpoint with the JWT strategy (so the `Authorization: Bearer <JWT>` header needs to be set) and uses the user email to render the message:
```ts
import { authenticate } from '@feathersjs/express'