Skip to content

Commit 296e008

Browse files
committed
Fix token auth when service is missing
Make the `service` parameter optional when fetching a bearer token, since some registries do not use it. The same logic can be found in containerd: https://github.com/containerd/containerd/blob/61f91b963ef244daec1bda6700fe3f0b1aee50c6/core/remotes/docker/auth/fetch.go#L187
1 parent 9e733e9 commit 296e008

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

dxf/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ def authenticate(self,
302302
scope = ''
303303
url_parts = list(urlparse.urlparse(info['realm']))
304304
query = urlparse.parse_qsl(url_parts[4])
305-
query.append(('service', info['service']))
305+
if 'service' in info:
306+
query.append(('service', info['service']))
306307
query.extend(('scope', s) for s in scope.split())
307308
url_parts[4] = urlencode(query, True)
308309
url_parts[0] = 'https'

0 commit comments

Comments
 (0)