/**
  * Return an access token.
  *
  * @throws \RuntimeException
  * @return string|null
  */
 public function getAccessToken()
 {
     $accessToken = $this->getAccessTokenFromPersistence();
     $grandType = $this->configuration->getGrantType();
     if (null !== $accessToken) {
         if ($grandType !== $this->storage->get(self::GRAND_TYPE_KEY, null)) {
             throw new \RuntimeException('grand_type switching not supported');
         }
         return $accessToken;
     }
     if ('password' === $grandType) {
         $response = $this->requestAccessToken();
     } else {
         throw new \RuntimeException('invalid grand_type configured');
     }
     if (null === $response || 200 != $response->getStatusCode()) {
         return null;
     }
     return $this->setAccessTokenToPersistence($response);
 }