From 1933532ec5a436191e43c6fb43e34200c21536b2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 24 Jan 2018 16:07:02 +0100 Subject: [PATCH 1/2] Fix github authentication request, fixes #5767 --- src/Composer/Repository/Vcs/GitHubDriver.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 916150fa3..5c5c08cf2 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -361,7 +361,9 @@ class GitHubDriver extends VcsDriver } } $scopesFailed = array_diff($scopesNeeded, $scopesIssued); - if (!$headers || count($scopesFailed)) { + // non-authenticated requests get no scopesNeeded, so ask for credentials + // authenticated requests which failed some scopes should ask for new credentials too + if (!$headers || !count($scopesNeeded) || count($scopesFailed)) { $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata ('.$this->url.')'); } From a29ad2bfd68e4e692f960c7f25675595080692d1 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 24 Jan 2018 16:19:28 +0100 Subject: [PATCH 2/2] Add some more debugging info --- src/Composer/Downloader/DownloadManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Downloader/DownloadManager.php b/src/Composer/Downloader/DownloadManager.php index 77b41c5eb..0b1affc1d 100644 --- a/src/Composer/Downloader/DownloadManager.php +++ b/src/Composer/Downloader/DownloadManager.php @@ -160,8 +160,8 @@ class DownloadManager if ($installationSource !== $downloader->getInstallationSource()) { throw new \LogicException(sprintf( - 'Downloader "%s" is a %s type downloader and can not be used to download %s', - get_class($downloader), $downloader->getInstallationSource(), $installationSource + 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s', + get_class($downloader), $downloader->getInstallationSource(), $installationSource, $package )); }