Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication fails on HTTP REST calls (OAuth 1.0a "one-legged" auth) when using 127.0.0.1 instead of localhost in the URL. #760

Open
noamaster opened this issue Sep 18, 2023 · 1 comment

Comments

@noamaster
Copy link

Version Information

  • WordPress Version: 5.9.3
  • WooCommerce Version: 6.5.1
  • WooCommerce.NET Version: 0.8.6

Steps to replicate the issue

  1. Set up a local WordPress server running on localhost (in my case, I used http://localhost:8777)
  2. Using WooCommerce.NET, construct a new RestAPI class with url set to http://127.0.0.1:8777/wp-json/wc/v3/ and pass in a correct key and secret.
  3. Create a WCObject and call wc.Customer.GetAll() to get the error.

Note if you replace http://127.0.0.1:8777/wp-json/wc/v3/ with http://localhost:8777/wp-json/wc/v3/, authentication works correctly. My guess is that the OAuth signature on the server is always calced using localhost while WooCommerce.NET uses 127.0.0.1 when generating the signature before making the request.

Details of the error message if there is any

The error message from the server call is as follows:

System.Net.WebException: '{"code":"woocommerce_rest_authentication_error","message":"Invalid signature - provided signature does not match.","data":{"status":401}}'
@XiaoFaye
Copy link
Owner

What is your Url setting in the Wordpress server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants