Compact decoder in verifyAuthCode

This commit is contained in:
Peter Stuifzand 2020-07-27 22:42:20 +02:00
parent 45616fa60e
commit c13a483e32
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -182,10 +182,9 @@ func verifyAuthCode(code, redirectURI, authEndpoint, clientID string) (bool, *au
}
input := io.TeeReader(resp.Body, os.Stderr)
dec := json.NewDecoder(input)
var authResponse authResponse
err = dec.Decode(&authResponse)
if err != nil {
if err := json.NewDecoder(input).Decode(&authResponse); err != nil {
return false, nil, fmt.Errorf("while verifying authentication response from %s: %s", authEndpoint, err)
}