Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. GitHub.php

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\Util

Code

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;
}
RSS feed
Powered by Drupal