Open subatomicglue opened 7 years ago
Summary of negative responses (from typical inputs). I'd rather not have console spam for these:
Get Oauth Token from /oauth/token
, bad username
or password
in the request body:
{
"code": 503,
"error": "server_error",
"error_description": "server_error"
}
console:
OAuth2Error: false
at OAuth2Error (.../node_modules/oauth2-server/lib/error.js:30:12)
at .../node_modules/oauth2-server/lib/grant.js:226:26
at Object.model.getUser (.../src/oauth2-mysql-model.js:129:16)
at process._tickDomainCallback (internal/process/next_tick.js:129:7)
Get oauth token from /oauth/token
, invalid Authorization: Basic
string:
{
"code": 400,
"error": "invalid_client",
"error_description": "Client credentials are invalid"
}
console:
OAuth2Error: Client credentials are invalid
at OAuth2Error (.../node_modules/oauth2-server/lib/error.js:30:12)
at .../node_modules/oauth2-server/lib/grant.js:141:19
at Object.model.getClient (.../src/oauth2-mysql-model.js:47:32)
at process._tickDomainCallback (internal/process/next_tick.js:129:7)
/secret
endpoint call with 'authorise()' middleware, and invalid Bearer token:
{
"code": 401,
"error": "invalid_token",
"error_description": "The access token provided is invalid."
}
console:
OAuth2Error: The access token provided is invalid.
at OAuth2Error (.../node_modules/oauth2-server/lib/error.js:30:12)
at .../node_modules/oauth2-server/lib/authorise.js:114:19
at Object.model.getAccessToken (.../src/oauth2-mysql-model.js:18:32)
at process._tickDomainCallback (internal/process/next_tick.js:129:7)
How do I take control of this, and rid the console spam - customize the 503 and 400's to all be 401s, and give smarter reading responses than "server error".
I am seeing errors happening for typical events like bad password or invalid token in
oauth2-server
v2.4.1 when used withexpress
.How do I prevent these errors spewing from my express service?
Configuration:
my
model.getAccessToken
isEndpoints in express:
Is there a way to suppress?