Skip to content

Commit

Permalink
fix: set expires_in the proxy token response (#630)
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Ramasekar <[email protected]>
  • Loading branch information
aramase committed Nov 9, 2022
1 parent 0cd6d96 commit c4a69ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,12 @@ func doTokenRequest(ctx context.Context, clientID, resource, tenantID, authority
if err != nil {
return nil, errors.Wrap(err, "failed to acquire token")
}

return &token{
AccessToken: result.AccessToken,
Resource: resource,
Type: "Bearer",
// -10s is to account for current time changes between the calls
ExpiresIn: json.Number(strconv.FormatInt(int64(time.Until(result.ExpiresOn)/time.Second)-10, 10)),
// There is a difference in parsing between the azure sdks and how azure-cli works
// Using the unix time to be consistent with response from IMDS which works with
// all the clients.
Expand Down

0 comments on commit c4a69ec

Please sign in to comment.