Repository navigation
fix: clarify the error when an API key is no longer valid - #490
Conversation
|
CI failed at the Codecoverage step...we haven't set targets and aren't monitoring that, let's just remove that step. |
Hi @patelspratik , Thanks for reviewing. The Codecoverage failure appears to have been related to this Codecov incident. I reran the tests from the CI is now passing. But since you mentioned we don’t use this, could you please confirm that should we still go ahead and remove the Codecoverage step? |
not worth the re-review at this point. maybe down the line, but not a priority. |
Issue
When a user logs in with an API key that is later deleted, expires, or is malformed, CLI commands usage returns:
401 Unauthorized {"errors":[{"type":"UnauthorizedError"}]}Root Cause
HTTPResponseError.Error()inpkg/store/http.goformats all failed responses the same way and never looks at the status code or the token that failed. A 401 body has nomessagefield, so users get the generic URL + status + body fallback.Fix
pkg/store/http.go-HTTPResponseError.Error()now returns the new expiredAPIKeyMessage above the original message when the response is a 401 and the request token is a bak- API key.