WooCommerce.NET
WooCommerce.NET copied to clipboard
JWT authentication WCAuthWithJWT not working
Hi,
I am on Version 8.3.0 I have WooCommecre and JWT authentication for the WordPress API but i cannot get them to work together
At first i tried using the WordPress API on JWT and leaving the WooCommerce one on the basic authentication when i done this the WordPress works fine but API call to any WooCommerce endpoint result in this error
{
"code": "jwt_auth_bad_auth_header",
"message": "Authorization header malformed.",
"data": {
"status": 403
}
}
So i moved on to now trying to use the JWT authentication for both wordpress and WooCommerce this works fine in postman but i cannot get it working at all in me C# application using WooCommerce.NET 8.3.0
var rest = new RestAPI(wooUrl+"/wp-json/wc/v3/", username, password)
{
WCAuthWithJWT = true
};
//rest.
//using JWT
_wooClient = new WCObject(rest);
I have looked at the code of this version and found this should work but i get the following error i am am really hoping someone can help me out.
This is the error i am getting
{"code":"woocommerce_rest_authentication_error","message":"Consumer key is invalid.","data":{"status":401}}
I would really appreciate any advice as i have been stuck on this now a few days.
Version 0.8.4 just released, could you try again?
I have the 0.8.4 version installed, and I also use JWT Authentication.
I also get the same message if i try to use woocommerce API
System.Net.WebException
HResult=0x80131509
Messaggio={"code":"jwt_auth_bad_auth_header","message":"Authorization header malformed.","data":{"status":403}}
Origine=WooCommerce.NET
Analisi dello stack:
in WooCommerceNET.RestAPI.<SendHttpClientRequest>d__481.MoveNext() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in WooCommerceNET.RestAPI.<GetRestful>d__49.MoveNext() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in WooCommerceNET.Base.WCItem
1.<GetAll>d__11.MoveNext()
in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
Hello @XiaoFaye, @matteozoni , I also have the same issue with the latest updates. When I activate the plugin JWT authentication for the WordPress API to be able to use the wordpress api I can't use anymore the Woocommerce api. When I disable the plugin, I can use the Woocommerce Api again but impossible to use the Wordpress Api. Thanks in advance,
@fredoche1810 @XiaoFaye @ @matteozoni It seems I have same problem with you , can't use woocommerce and wordpress rest api togeter. so do you have final solution ? please help me.
@fredoche1810 @XiaoFaye @ @matteozoni It seems I have same problem with you , can't use woocommerce and wordpress rest api togeter. so do you have final solution ? please help me.
I'm sorry but I gave up.