public function onBeforeSend(Event $event) { if (!$this->token) { $this->token = $this->tokenStorage->fetch(); } if (!$this->token || $this->token->isExpired()) { $this->token = $this->flow->getToken(); $this->tokenStorage->store($this->token); } $request = $event['request']; $request->setHeader('Authorization', sprintf('Bearer %s', $this->token)); }
/** * @param array $configs * @param ClientInterface $client * @param LoggerInterface $logger */ public function __construct(array $configs, ClientInterface $client = null, LoggerInterface $logger = null) { parent::__construct($configs, $client, $logger); $this->email = $configs['email']; $this->accountId = $configs['account_id']; }
/** * @param array $configs * @param ClientInterface $client * @param LoggerInterface $logger */ public function __construct(array $configs, ClientInterface $client = null, LoggerInterface $logger = null) { parent::__construct($configs, $client, $logger); }