1
0
Fork 0

Fixed OAuth credentials issue for subsequent clone requests.

pull/5055/head
Paul.Wenke 2016-03-13 16:57:23 -04:00
parent d2c5479b2d
commit 9ddf8c4d55
1 changed files with 7 additions and 3 deletions

View File

@ -114,7 +114,7 @@ class Git
return;
}
}
} elseif (preg_match('{^(?:https?|git)://'.self::getBitbucketDomainsRegex($this->config).'/(.*)\.git}', $url, $match)) { //bitbucket oauth
} elseif (preg_match('{^(?:https?|git)://'.self::getBitbucketDomainsRegex($this->config).'/(.*)}', $url, $match)) { //bitbucket oauth
$bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
if (!$this->io->hasAuthentication($match[1])) {
@ -127,8 +127,12 @@ class Git
}
} else { //We're authenticating with a locally stored consumer.
$auth = $this->io->getAuthentication($match[1]);
$token = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
$this->io->setAuthentication($match[1], 'x-token-auth', $token['access_token']);
//We already have an access_token from a previous request.
if($auth['username'] !== 'x-token-auth') {
$token = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
$this->io->setAuthentication($match[1], 'x-token-auth', $token['access_token']);
}
}
if ($this->io->hasAuthentication($match[1])) {