TODO: Installation instructions, when published on npmjs.
Configuration
A complete reference implementation is available in the /examples directory.
The sample implements the following grant flows:
Password (resource owner password credentials)
Authorization code
Refresh token
Client credentials
Additional features
This middleware extends upon the base oauth2 library by providing the following:
Scope verification middleware
Allows for protecting individual routes or routers with scope keys.
If no method is provided, a default method performing substring matching will
be used.
Takes requiredScope and token as input, should return boolean true to
indicate that the required scope was encountered, or boolean false or a
string to indicate that it was not.
If false is returned, the default error message will read:
"Required scope: `{requiredScope}`"
Example
Note: The below corresponds to the fallback checkScope implementation.
请发表评论