According to https://tools.ietf.org/html/rfc6749#section-5.2 an error response is returned mostly when the HTTP status code is 400, but in some cases for example in GitHub an error response can be raised even when the status code is 200. In this case internal.RetrieveToken() parses the output but with missing parameters, and continues, but the token struct is half-baked.