Skip to content

Commit

Permalink
Interpret 400 on token check as invalid token
Browse files Browse the repository at this point in the history
If your not token is not formatted validly for the current version of
Vault, some Vault versions will give you back a 400. Handle this as
a response to tell the user their token is invalid.
  • Loading branch information
thomasmitchell committed Oct 2, 2020
1 parent 80e08c3 commit d8b54a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,9 @@ Flags:
tokenInfo, err := v.Client().Client.TokenInfoSelf()
var tokenObj TokenStatus
if err != nil {
if !(vaultkv.IsForbidden(err) || vaultkv.IsNotFound(err)) {
if !(vaultkv.IsForbidden(err) ||
vaultkv.IsNotFound(err) ||
vaultkv.IsBadRequest(err)) {
return err
}
} else {
Expand Down

0 comments on commit d8b54a4

Please sign in to comment.