You are here

public function ClientCredentials::getToken in Commerce PayPal 8

File

src/ClientCredentials.php, line 40

Class

ClientCredentials
Client credentials grant type.

Namespace

Drupal\commerce_paypal

Code

public function getToken() {
  $token = parent::getToken();

  // Store the token retrieved for later reuse (to make sure we don't request
  // for a new one on each API request).
  $this->state
    ->set($this->config['token_key'], [
    'token' => $token
      ->getToken(),
    'expires' => $token
      ->getExpires()
      ->getTimestamp(),
  ]);
  return $token;
}