1
0
Fork 0

Allow use of Github OAuth2 token stored in git config

pull/1241/head
Wes Mason 2012-10-21 01:06:56 +01:00
parent 344df03253
commit 2cb07dd2fe
1 changed files with 9 additions and 0 deletions

View File

@ -350,6 +350,15 @@ class GitHubDriver extends VcsDriver
protected function authorizeOAuth()
{
// If available use token from git config
exec('git config github.accesstoken', $output, $returnCode);
if ($returnCode === 0 && !empty($output[0]))
{
$this->io->write('Using Github OAuth token stored in git config (github.accesstoken)');
$this->io->setAuthorization($this->originUrl, $output[0], 'x-oauth-basic');
return;
}
$attemptCounter = 0;
$this->io->write('The credentials will be swapped for an OAuth token stored in '.$this->config->get('home').'/config.json, your password will not be stored');