Skip to content

Commit

Permalink
More info in auth middleware docs (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjmcgrath authored Apr 3, 2023
2 parents d363f7e + 0b745aa commit 0245f71
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/express-oauth2-jwt-bearer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ declare global {
* You must provide the `audience` argument (or `AUDIENCE` environment variable)
* used to match against the Access Token's `aud` claim.
*
* Successful requests will have the following properties added to them:
*
* ```js
* app.get('/foo', auth(), (req, res, next) => {
* const auth = req.auth;
* auth.header; // The decoded JWT header.
* auth.payload; // The decoded JWT payload.
* auth.token; // The raw JWT token.
* });
* ```
*
*/
export const auth = (opts: AuthOptions = {}): Handler => {
const verifyJwt = jwtVerifier(opts);
Expand Down

0 comments on commit 0245f71

Please sign in to comment.