Fixed OAuth credentials issue for subsequent clone requests.
parent
d2c5479b2d
commit
9ddf8c4d55
|
@ -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])) {
|
||||
|
|
Loading…
Reference in New Issue