fix jwt token desynchronization between crowdsec and lapi (#572)
This commit is contained in:
parent
fbfd5de096
commit
9ec0ea08bb
|
@ -189,10 +189,10 @@ func (t *JWTTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
resp, err := t.transport().RoundTrip(req)
|
resp, err := t.transport().RoundTrip(req)
|
||||||
if log.GetLevel() >= log.TraceLevel {
|
if log.GetLevel() >= log.TraceLevel {
|
||||||
dump, _ := httputil.DumpResponse(resp, true)
|
dump, _ := httputil.DumpResponse(resp, true)
|
||||||
log.Tracef("resp-jwt: %s", string(dump))
|
log.Tracef("resp-jwt: %s (err:%s)", string(dump), err)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil || resp.StatusCode == 401 {
|
||||||
/*we had an error, reset the token ?*/
|
/*we had an error (network error for example, or 401 because token is refused), reset the token ?*/
|
||||||
t.token = ""
|
t.token = ""
|
||||||
return resp, errors.Wrapf(err, "performing jwt auth")
|
return resp, errors.Wrapf(err, "performing jwt auth")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue