public function refresh()
    {

        if (!$this->_auth->refreshTokenValid()) {
            throw new ApiException(null, new Exception('Refresh token has expired'));
        }

        // Synchronous
        $response = $this->requestToken(self::TOKEN_ENDPOINT, array(
            "grant_type"        => "refresh_token",
            "refresh_token"     => $this->_auth->refreshToken(),
            "access_token_ttl"  => self::ACCESS_TOKEN_TTL,
            "refresh_token_ttl" => self::REFRESH_TOKEN_TTL
        ));

        $this->_auth->setData($response->jsonArray());

        return $response;

    }
public function refresh()
    {

        if (!$this->_auth->refreshTokenValid()) {
            throw new ApiException(null, new Exception('Refresh token has expired'));
        }

        // Synchronous
        $response = $this->requestToken(self::TOKEN_ENDPOINT, array(
            "grant_type"        => "refresh_token",
            "refresh_token"     => $this->_auth->refreshToken(),
            "access_token_ttl"  => self::ACCESS_TOKEN_TTL,
            "refresh_token_ttl" => self::REFRESH_TOKEN_TTL
        ));

        $this->_auth->setData($response->jsonArray());

        return $response;

    }
public function refresh ( ) { if ( ! $ this -> _auth -> refreshTokenValid ( ) ) { throw new ApiException ( null , new Exception ( 'Refresh token has expired' ) ) ; } // Synchronous $ response = $ this -> requestToken ( self :: TOKEN_ENDPOINT , array ( "grant_type" => "refresh_token" , "refresh_token" => $ this -> _auth -> refreshToken ( ) , "access_token_ttl" => self :: ACCESS_TOKEN_TTL , "refresh_token_ttl" => self :: REFRESH_TOKEN_TTL ) ) ; $ this -> _auth -> setData ( $ response -> jsonArray ( ) ) ; return $ response ; }
Attempt to request new access and refresh tokens using the existing refresh token.

@throws ApiException If the existing refresh token is invalid or there is an issue with the request.
@throws Exception    If it fails to retrieve/parse JSON data from he response.

@return ApiResponse
Attempt to request new access and refresh tokens using the existing refresh token .