question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server sends 200 response when secret key changes, not 401

See original GitHub issue

When 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jckwcommented, Apr 19, 2019

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.

0reactions
jayhalecommented, Aug 7, 2019

@themotu, we avoided this library and instead wrote the authenticator in-house.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found