From 78797df5f81509a24959b35209476beab9e2a5ad Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 30 Oct 2020 17:28:30 +0100 Subject: [PATCH] Fix bitbucket handling, fixes #9369 --- src/Composer/Util/Bitbucket.php | 2 +- src/Composer/Util/RemoteFilesystem.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Composer/Util/Bitbucket.php b/src/Composer/Util/Bitbucket.php index 1fc286ac4..0875bc34a 100644 --- a/src/Composer/Util/Bitbucket.php +++ b/src/Composer/Util/Bitbucket.php @@ -135,7 +135,7 @@ class Bitbucket $this->io->writeError($message); } - $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html'; + $url = 'https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/'; $this->io->writeError(sprintf('Follow the instructions on %s', $url)); $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName())); $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)'); diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index cc4cb61f4..12eb05bb2 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -699,8 +699,10 @@ class RemoteFilesystem ) { throw new TransportException('Could not authenticate against '.$this->originUrl, 401); } - } elseif ($this->config && $this->originUrl === 'bitbucket.org') { + } elseif ($this->config && ($this->originUrl === 'bitbucket.org' || $this->originUrl === 'api.bitbucket.org')) { $askForOAuthToken = true; + $this->originUrl = 'bitbucket.org'; + if ($this->io->hasAuthentication($this->originUrl)) { $auth = $this->io->getAuthentication($this->originUrl); if ($auth['username'] !== 'x-token-auth') {