{"repo":"auth0/express-jwt-authz","free":true,"listed":false,"github":"https://github.com/auth0/express-jwt-authz","clone":"git clone https://github.com/auth0/express-jwt-authz.git","description":"Validate the JWT scope to authorize access to an endpoint","language":"JavaScript","stars":98,"topics":["jwt","express","dx-sdk"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"express-jwt-authz Validate a JWTs scope to authorize access to an endpoint. Install $ npm install express-jwt-authz express@^4.0.0 is a peer dependency. Make sure it is installed in your project. Usage Use together with express-jwt to both validate a JWT and make sure it has the correct permissions to call an endpoint. :note: express-jwt sets the decoded JWT payload on req.auth since version 6.0.0 , so make sure to set customUserKey: 'auth' in the options provided to express-jwt-authz if you are using that version or newer. If multiple scopes are provided, the user must have at least one of the specified scopes. To check that the user has all the scopes provided, use the checkAllScopes: true option: The JWT must have a scope claim and it must either be a string of space-separated permissions or an array of strings. For example: Options - failWithError : When set to true , will forward errors to next instead of ending the response directly. Defaults to false . - checkAllScopes : When set to true , all the expected scopes will be checked against the user's scopes. Defaults to false . - customUserKey : The property name to check for the scope key. By default, permissions are checked against req.user , but you can change it to be req.myCustomUserKey with this option. Defaults to user . - customScopeKey : The property name to check for the actual scope. By default, permissions are checked against user.scope , but you can change it to be user.myCustomScopeKey with this option. Defa","default_branch":null,"files":null,"tree":[],"storefront":"/r/auth0","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/auth0/express-jwt-authz/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}