WooCommerce REST API not working Authentication Error - Invalid TimeStamp
stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [code] => woocommerce_api_authentication_error [message] => oauth_timestamp parameter is missing )
)
)
exception 'WC_API_Client_HTTP_Exception' with message 'Error: oauth_timestamp parameter is missing [woocommerce_api_authentication_error]' in /var/www/html/cron/WCTX/lib/woocommerce-api/class-wc-api-client-http-request.php:211 Stack trace: #0 /var/www/html/cron/WCTX/lib/woocommerce-api/class-wc-api-client.php(286): WC_API_Client_HTTP_Request->dispatch() #1 /var/www/html/cron/WCTX/lib/woocommerce-api/resources/abstract-wc-api-client-resource.php(122): WC_API_Client->make_api_call('GET', 'orders', Array) #2 /var/www/html/cron/WCTX/lib/woocommerce-api/resources/class-wc-api-client-resource-orders.php(42): WC_API_Client_Resource->do_request() #3 /var/www/html/sites/all/modules/WCTX/WCTX_Form.admin.inc(465): WC_API_Client_Resource_Orders->get() #4 /var/www/html/sites/all/modules/WCTX/WCTX_Form.admin.inc(629): loginWCTX('http://hirevisi...', 'ck_4a27c0ee9a4b...', 'cs_df7b9703fd11...') #5 /var/www/html/sites/all/modules/WCTX/WCTX_Form.admin.inc(360): woocommerce_submitWCTX() #6 /var/www/html/sites/all/modules/WCTX/WCTX_Form.admin.inc(144): WCTX_Form_mainsubmit() #7 [internal function]: WCTX_Form(Array, Array) #8 /var/www/html/includes/form.inc(799): call_user_func_array('WCTX_Form', Array) #9 /var/www/html/includes/form.inc(339): drupal_retrieve_form('WCTX_Form', Array) #10 /var/www/html/includes/form.inc(131): drupal_build_form('WCTX_Form', Array) #11 [internal function]: drupal_get_form('WCTX_Form')
We are receiving nothing while working on REST API v2 version of WooCommerce. It was working fine when we are retrieving data from localhost which is http but now we have uploaded it to the server which is https. we have also clear the cache of wordpress. Still getting
stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [code] => woocommerce_api_authentication_error [message] => Invalid Timesatmp )
)
) How can we covert the timestamp to server timestamp in the code Here is the function from where the timesatmp is generating public function get_oauth_params( $params, $method ) {
$params = array_merge( $params, array(
'oauth_consumer_key' => $this->consumer_key,
'oauth_timestamp' => time(),
'oauth_nonce' => sha1( microtime() ),
'oauth_signature_method' => 'HMAC-' . self::HASH_ALGORITHM,
) );
// the params above must be included in the signature generation
$params['oauth_signature'] = $this->generate_oauth_signature( $params, $method );
return $params;
}