Gathering detailed insights and metrics for @667/express-jwt-authz
Gathering detailed insights and metrics for @667/express-jwt-authz
Gathering detailed insights and metrics for @667/express-jwt-authz
Gathering detailed insights and metrics for @667/express-jwt-authz
Validate the JWT scope to authorize access to an endpoint
npm install @667/express-jwt-authz
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
62 Commits
1 Watchers
2 Branches
1 Contributors
Updated on Mar 23, 2021
Latest Version
2.4.1-1
Package Id
@667/express-jwt-authz@2.4.1-1
Unpacked Size
8.31 kB
Size
3.43 kB
File Count
6
NPM Version
6.14.11
Node Version
12.21.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
5
This fork of https://github.com/auth0/express-jwt-authz supports restify as well as express.
Validate a JWTs scope
to authorize access to an endpoint.
$ npm install express-jwt-authz
restify@^8.5.1
is a peer dependency.express@^4.0.0
is a peer dependency. Make sure one of them is installed in your project.
Use together with express-jwt to both validate a JWT and make sure it has the correct permissions to call an endpoint.
1var jwt = require('express-jwt'); 2var jwtAuthz = require('express-jwt-authz'); 3 4var options = {}; 5app.get('/users', 6 jwt({ secret: 'shared_secret' }), 7 jwtAuthz([ 'read:users' ], options), 8 function(req, res) { ... });
If multiple scopes are provided, the user must have at least one of the specified scopes.
1app.post('/users', 2 jwt({ secret: 'shared_secret' }), 3 jwtAuthz([ 'read:users', 'write:users' ], {}), 4 function(req, res) { ... }); 5 6// This user will be granted access 7var authorizedUser = { 8 scope: 'read:users' 9};
To check that the user has all the scopes provided, use the checkAllScopes: true
option:
1app.post('/users', 2 jwt({ secret: 'shared_secret' }), 3 jwtAuthz([ 'read:users', 'write:users' ], { checkAllScopes: true }), 4 function(req, res) { ... }); 5 6// This user will have access 7var authorizedUser = { 8 scope: 'read:users write:users' 9}; 10 11// This user will NOT have access 12var unauthorizedUser = { 13 scope: 'read:users' 14};
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:
// String:
"write:users read:users"
// Array:
["write:users", "read:users"]
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. Defaults to scope
.For issues directly related to restify support, please report them at this reposittory issues section.
If you have found a bug or if you have a feature request, please report them at https://github.com/auth0/express-jwt-authz/issues. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
This project is licensed under the MIT license. See the LICENSE file for more info.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More