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

Breadcrumb

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

function Bitbucket::requestToken

Retrieves an access token from Bitbucket.

File

vendor/composer/composer/src/Composer/Util/Bitbucket.php, line 195

Class

Bitbucket
@author Paul Wenke <wenke.paul@gmail.com>

Namespace

Composer\Util

Code

public function requestToken(string $originUrl, string $consumerKey, string $consumerSecret) : string {
    if ($this->token !== null || $this->getTokenFromConfig($originUrl)) {
        return $this->token['access_token'];
    }
    $this->io
        ->setAuthentication($originUrl, $consumerKey, $consumerSecret);
    if (!$this->requestAccessToken()) {
        return '';
    }
    $this->storeInAuthConfig($this->config
        ->getLocalAuthConfigSource() ?? $this->config
        ->getAuthConfigSource(), $originUrl, $consumerKey, $consumerSecret);
    if (!isset($this->token['access_token'])) {
        throw new \LogicException('Failed to initialize token above');
    }
    return $this->token['access_token'];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal