From 7716ef059b67fb4cee49bccfcc574dfc840e30e1 Mon Sep 17 00:00:00 2001 From: Stefan Grootscholten Date: Wed, 8 Jun 2016 20:56:11 +0200 Subject: [PATCH] Add the access token as query string parameter. --- src/Composer/Util/RemoteFilesystem.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index b7cf90609..3d0f0ae91 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -245,6 +245,11 @@ class RemoteFilesystem unset($options['gitlab-token']); } + if (isset($options['bitbucket-token'])) { + $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['bitbucket-token']; + unset($options['bitbucket-token']); + } + if (isset($options['http'])) { $options['http']['ignore_errors'] = true; } @@ -692,7 +697,7 @@ class RemoteFilesystem } } elseif ('bitbucket.org' === $originUrl && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL) { if ('x-token-auth' === $auth['username']) { - $headers[] = 'Authorization: Bearer ' . $auth['password']; + $options['bitbucket-token'] = $auth['password']; } } else { $authStr = base64_encode($auth['username'] . ':' . $auth['password']);