google: change json decoding layout

Change-Id: Idc322fc66cb93e5d61f0c41d5847a2567a5e1019
This commit is contained in:
Patrick Jones 2020-11-12 11:43:19 -08:00
parent 57d1f928e5
commit ccc73e0caf
1 changed files with 5 additions and 6 deletions

View File

@ -31,8 +31,8 @@ func ExchangeToken(ctx context.Context, endpoint string, request *STSTokenExchan
if err != nil {
return nil, fmt.Errorf("oauth2/google: failed to marshal additional options: %v", err)
}
data.Set("options", string(opts))
authentication.InjectAuthentication(data, headers)
encodedData := data.Encode()
@ -57,14 +57,13 @@ func ExchangeToken(ctx context.Context, endpoint string, request *STSTokenExchan
bodyJson := json.NewDecoder(io.LimitReader(resp.Body, 1<<20))
var stsResp STSTokenExchangeResponse
for bodyJson.More() {
err = bodyJson.Decode(&stsResp)
if err != nil {
return nil, fmt.Errorf("oauth2/google: failed to unmarshal response body from Secure Token Server: %v", err)
err = bodyJson.Decode(&stsResp)
if err != nil {
return nil, fmt.Errorf("oauth2/google: failed to unmarshal response body from Secure Token Server: %v", err)
}
}
return &stsResp, nil
}