/** * Refresh this AccessToken */ public function refresh() { $grant = new ClientCredentialsGrantRequest($this->clientId, $this->clientSecret, $this->scopes); $tokens = $grant->getTokens(); $this->accessToken = $tokens->{"access_token"}; $this->expiresAt = Util::calculateExpiryTime($tokens->{"expires_in"}); }
/** * Get an AccessToken for use when communicating with the Zara 4 API service. * * @return ReissuableAccessToken */ public function acquireAccessToken() { $grant = new ClientCredentialsGrantRequest($this->clientId, $this->clientSecret, $this->scopes); $tokens = $grant->getTokens(); $accessToken = $tokens->{"access_token"}; $expiresAt = Util::calculateExpiryTime($tokens->{"expires_in"}); return new ReissuableAccessToken($this->clientId, $this->clientSecret, $accessToken, $expiresAt, $this->scopes); }