Server sends 200 response when secret key changes, not 401
See original GitHub issueWhen the server secret key changes all tokens are invalidated because they can no longer be decrypted. However, instead of returning a response with code 401-Unauthorized, the server returns a response with code 200-OK and includes the deserialization error in the response.
Example response:
{
"errors":[
{
"message":"Error decoding signature",
"locations":[
{
"line":1,
"column":38
}
],
"path":[
"createTeam"
]
}
],
"data":{
"createTeam":null
}
}
If time allows, I’ll follow this up with a PR to correct the issue.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
401 Unauthorized Error: What It Is and How to Fix It
The 401 Unauthorized Error is an HTTP response status code indicating that the client could not authenticate a request.
Read more >HTTP 401 Unauthorized Error | What Is and How to Fix?
401 Unauthorized Error is an HTTP response status code indicating the request sent by the user couldn't be authenticated.
Read more >How to Quickly Fix the 401 Unauthorized Error (5 Methods)
Look for Errors in the URL; Clear Your Browser's Cache; Flush Your DNS; Deactivate Your WordPress Plugins; Check the WWW-Authenticate Header ...
Read more >Is it possible to send a 401 Unauthorized AND redirect (with a ...
Just out of curiosity, I tried requesting the URL for one of my private Amazon wishlists while unauthenticated, and received a 200 OK...
Read more >API calls and HTTP Status codes - ITNEXT
What status code should the server return? · 200 The request is successful as the endpoint does exist and makes some internal validation,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think @jayhale is suggesting that the response status code is changed to HTTP 401 instead. That way, generic middleware can recognise when a request was unsuccessful due to a token being invalid and can automatically refresh it.
@themotu, we avoided this library and instead wrote the authenticator in-house.