woocommerce / woocommerce/wc-api-php
woocommerce_rest_authentication_error
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 546
- Forks
- 158
- Avg merge
- 3h 21m
- Merged PRs (30d)
- 2
Description
Hello everyone,
I'm currently trying to build a WordPress plugin that communicates with the WooCommerce API. This library looked like the perfect fit for the job but I can't get it to run on my local development machine.
The WordPress/WooCommerce setup is working fine because I can query the API without any problems from Postman. The problem starts when I want to use the library.
$this->wc_client = new Client(
$url,
$consumer_key,
$consumer_secret,
[
'wp_api' => true,
'query_string_auth' => true,
]
);
This is how I create the client. And I am 100% sure the consumer_key and consumer_secret is correct, because they work via Postman.
My query looks like this:
$result = $this->wc_client->get('products');
The result I get is a HttpClientException with a woocommerce_rest_authentication_error and the message that the signature does not match.
Edit: The status code I receive is 401.
I'm pretty sure this is because I don't have a secure connection set up on my machine, but it feels like there should be an easier solution for a development environment.
Has someone solved this problem already?
Thanks in advance!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by tracing the PHP Client construction with wp_api and query_string_auth, then the get('products') request, and compare its signing path with the successful Postman request. Done would require a reproducible fix or documented cause for the 401 signature-mismatch error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100