Compatibility fix with docker_auth v1.5.0

This commit is contained in:
Roman Vynar 2020-02-19 12:36:55 +02:00
parent b6398fa33c
commit 65c9978bd1
2 changed files with 9 additions and 2 deletions

View File

@ -13,6 +13,7 @@
(thanks to @gminog).
* Fix initial ownership of /opt/data dir in Dockerfile.
* Hide repositories with 0 tags count.
* Compatibility fix with docker_auth v1.5.0.
### 0.8.2 (2019-07-30)

View File

@ -106,8 +106,14 @@ func (c *Client) getToken(scope string) string {
return ""
}
c.tokens[scope] = gjson.Get(data, "token").String()
c.logger.Info("Received new token for scope ", scope)
token := gjson.Get(data, "token").String()
// Fix for docker_auth v1.5.0 only
if token == "" {
token = gjson.Get(data, "access_token").String()
}
c.tokens[scope] = token
c.logger.Debugf("Received new token for scope %s", scope)
return c.tokens[scope]
}