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 )); } 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.')'); }