/** * Refresh an existing access token * * @return AccessToken * @throws \Exception */ public function refreshToken() { $url = $this->salesforceLoginUrl . 'services/oauth2/token'; $post_data = ['grant_type' => 'refresh_token', 'client_id' => $this->clientId, 'client_secret' => $this->clientSecret, 'refresh_token' => $this->accessToken->getRefreshToken()]; $response = $this->makeRequest('post', $url, ['form_params' => $post_data]); $update = json_decode($response->getBody(), true); $this->accessToken->updateFromSalesforceRefresh($update); return $this->accessToken; }