Closed
Description
I am using a custom verify method. When I tamper the signature part of the token I am getting a 500 error instead of 401.
- The code here gives null as decoded token if signature is not valid
- When my verify method returns isValid as false then the returned credentials are null as decoded value is null here
- Then toolkits unauthenticated method is called here
- Finally failing here with following error message and 500 status code
Debug: internal, implementation, error
AssertionError [ERR_ASSERTION]: Authentication data missing credentials information
at new AssertionError (internal/assert.js:269:11)
Final response to client is
{
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal server error occurred"
}
Can you please let me know how to solve this issue.