Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,117 members, 7,953,435 topics. Date: Thursday, 19 September 2024 at 04:10 PM |
Nairaland Forum / Science/Technology / Programming / Help With Woocommerce Rest API (1017 Views)
Django Rest Api - Dropdown Of Countries And States In The World / [php Tutorial] - Building A Rest Api / How To Develop Android And iOS Mobile App In Magento2 With Rest API (2) (3) (4)
Help With Woocommerce Rest API by Nobody: 4:37pm On Nov 10, 2019 |
This is supposed to be simple and straight forward but for some reason, it's giving me sleepless nights. I'm trying to connect an App to my woo commerce Wordpress store. I already generated my rest API keys but this app cannot connect. In fact, it seems the error is from my server because when I try to authenticate even when logged in, it fails. https://shoppebyperidot.com//wp-json/wc/v2/system_status?consumer_key=ck_56f7cd975b9e63055ca74a135d065f6d814301b2&consumer_secret=cs_b642fe645940e983f4e44346cd45b8ae24e49c6b Returns error {"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot list resources.","data":{"status":401}} But when I try this on a different hosting account ( Namecheap ) there is no issue at all https://duremon.com//wp-json/wc/v2/system_status?consumer_key=ck_4f37e8fd284a79cd83836208adfe9367a078ca2d&consumer_secret=cs_35959c87abfb2e32f85a3a27fa6b0cf8476e3f97 will return a json file but the other one will fail, please what am I missing? (Modify) (Quote) (Report) (Share) |
Re: Help With Woocommerce Rest API by Nobody: 3:48pm On Nov 11, 2019 |
grossintel:Chat me up for a solution on 0-8-1-3-8-6-6-3-6-9-7 |
Re: Help With Woocommerce Rest API by Nobody: 4:55pm On Nov 11, 2019 |
it depend on the type of theme you used or rather default hosting try www.hostamcheap |
Re: Help With Woocommerce Rest API by Nobody: 8:20pm On Nov 11, 2019 |
miccolo2:Thanks a lot, but av'e fixed the issue. |
Re: Help With Woocommerce Rest API by Nobody: 8:27pm On Nov 11, 2019 |
quexhub:Actually it's from the theme itself, had to use a hack on Woocommerce but that means I can't update it. Is there any way I can use this on a child theme or something? This is the CODE private function perform_basic_authentication() { $this->auth_method = 'basic_auth'; $consumer_key = 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; $consumer_secret = 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // If the $_GET parameters are present, use those first. if ( ! empty( $_GET['consumer_key'] ) && ! empty( $_GET['consumer_secret'] ) ) { // WPCS: CSRF ok. $consumer_key = $_GET['consumer_key']; // WPCS: CSRF ok, sanitization ok. $consumer_secret = $_GET['consumer_secret']; // WPCS: CSRF ok, sanitization ok. } // If the above is not present, we will do full basic auth. if ( ! $consumer_key && ! empty( $_SERVER['PHP_AUTH_USER'] ) && ! empty( $_SERVER['PHP_AUTH_PW'] ) ) { $consumer_key = $_SERVER['PHP_AUTH_USER']; // WPCS: CSRF ok, sanitization ok. $consumer_secret = $_SERVER['PHP_AUTH_PW']; // WPCS: CSRF ok, sanitization ok. } // Stop if don't have any key. if ( ! $consumer_key || ! $consumer_secret ) { return false; } // Get user data. $this->user = $this->get_user_data_by_consumer_key( $consumer_key ); if ( empty( $this->user ) ) { return false; } // Validate user secret. if ( ! hash_equals( $this->user->consumer_secret, $consumer_secret ) ) { // @codingStandardsIgnoreLine $this->set_error( new WP_Error( 'woocommerce_rest_authentication_error', __( 'Consumer secret is invalid.', 'woocommerce' ), array( 'status' => 401 ) ) ); return false; } return $this->user->user_id; } |
Re: Help With Woocommerce Rest API by Pgateway: 5:24am On Nov 14, 2019 |
. |
(1) (Reply)
How Do I Remove This Text...kindly Help / I Want To Invest In A Big Telecoms Project Any Ideas / Niit Students:
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 18 |