getCredentials() публичный Метод

Returns the credentials/token for the Authorization header
public getCredentials ( ) : string
Результат string
Пример #1
0
 /**
  * @param string $method HTTP method.
  * @param string|\Psr\Http\Message\UriInterface $uri URI object or string.
  * @param array $options Request options to apply.
  *
  * @return ResponseInterface
  * @throws \GuzzleHttp\Exception\GuzzleException
  */
 public function request($method, $uri, $options = [])
 {
     if ($this->authorization !== null) {
         $authHeader = sprintf('%s %s', $this->authorization->getAuthType(), $this->authorization->getCredentials());
         $headers = isset($options['headers']) ? $options['headers'] : [];
         $headers['Authorization'] = $authHeader;
         $options['headers'] = $headers;
     }
     return $this->client->request($method, $uri, $options);
 }
Пример #2
0
 /**
  * Changes the authentication method on all the requests made by this client
  * @param \Snorlax\Auth\Authorization $auth The authorizaztion method
  */
 public function setAuthMethod(Authorization $auth)
 {
     $this->client->setDefaultOption('headers', ['Authorization' => sprintf('%s %s', $auth->getAuthType(), $auth->getCredentials())]);
 }