/** * * @return Bridge_Api_Auth_OAuth2 */ public function reconnect() { $post_params = ['client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'refresh_token' => $this->settings->get('refresh_token'), 'grant_type' => 'refresh_token']; $response = http_query::getUrl($this->token_endpoint, $post_params); $response = json_decode($response, JSON_HEX_TAG | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_HEX_APOS); if (!is_array($response) || !isset($response['access_token'])) { throw new Bridge_Exception_ApiConnectorAccessTokenFailed(); } $this->settings->set('auth_token', $response['access_token']); return $this; }