Skip to content

Commit

Permalink
fix(auth): Use token self-renewal (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhamann committed May 30, 2020
1 parent 1ed36be commit bd9b7ac
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions auth.go
Expand Up @@ -30,12 +30,11 @@ func (c *Client) renewToken() {
duration := c.token.TTL - 2
time.Sleep(time.Second * time.Duration(duration))

url := c.address.String() + "/v1/auth/token/renew"

jsonToken["token"] = c.getTokenID()
url := c.address.String() + "/v1/auth/token/renew-self"

req, _ := c.newRequest("POST", url)


// Sending a payload (even empty) is required for vault to respond with the `auth` param
_ = req.setJSONBody(jsonToken)

resp, err := req.execute()
Expand Down

0 comments on commit bd9b7ac

Please sign in to comment.