Closed
Description
Specify your setup
- Operating System:
- Node version:
- npm version:
- version of @node-oauth/oauth2-server
- which OAuth2 workflow:
- at which workflow step does the error occur:
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- In the token endpoint, supply grant type as
client_credentials
. - Pass the access token from the previous step to a route that uses
OAuthServer.server.authenticate
. - Result will be
invalid_token: Invalid token: access token is invalid
.
Alternatively, please add a link to a GitHub repo
that reproduces the error/s.
It is possible to do a quick check in a dev deployment of my project: https://liquid-pe2r.onrender.com (It is very slow on the first request, so give it a minute to load, and then do the API call).
- Send request to https://liquid-pe2r.onrender.com/oauth/token
- Sample client-credentials: client_id: application_client, client_secret: super-secure-client-secret
- Scope: system.client.all
- Now try to access http://localhost:2000/system/client-api/stats (Which can be accessed only by clients).
You should see an unauthorized.
Expected behavior
The server should accept the valid token.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
The problem seems to be due to a different token passed to getAccessToken
function in the model than the one that was returned by authorize function..