diff --git a/docker_registry_client_async/dockerregistryclientasync.py b/docker_registry_client_async/dockerregistryclientasync.py index f2d4db3..86f809c 100644 --- a/docker_registry_client_async/dockerregistryclientasync.py +++ b/docker_registry_client_async/dockerregistryclientasync.py @@ -278,9 +278,13 @@ async def _get_auth_token( headers = {} if credentials: headers["Authorization"] = f"Basic {credentials}" - url = GENERIC_OAUTH2_URL_PATTERN.format( - bearer["realm"], bearer["service"], scope - ) + if "service" not in bearer: + oauth2_url_pattern_without_service = "{0}?scope={1}&client_id=docker-registry-client-async" + url = oauth2_url_pattern_without_service.format(bearer["realm"], scope) + else: + url = GENERIC_OAUTH2_URL_PATTERN.format( + bearer["realm"], bearer["service"], scope + ) client_response = await client_session.get( headers=headers, raise_for_status=True,