function GitHub::authorizeOAuth
Attempts to authorize a GitHub domain via OAuth
Parameters
string $originUrl The host this GitHub instance is located at:
Return value
bool true on success
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ GitHub.php, line 57
Class
- GitHub
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\UtilCode
public function authorizeOAuth(string $originUrl) : bool {
if (!in_array($originUrl, $this->config
->get('github-domains'))) {
return false;
}
// if available use token from git config
if (0 === $this->process
->execute([
'git',
'config',
'github.accesstoken',
], $output)) {
$this->io
->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
return true;
}
return false;
}