Repository navigation
Closed
Description
The error occurs when trying to retrieve all orders from the api, passing "after" or "before" as parameter. The following code reproduces the error:
Map<String, String> param = new HashMap<>();
param.put("after", "2019-08-08T00:00:00");
OAuthConfig config = new OAuthConfig(url, consumerKey, consumerSecret);
WooCommerce api = new WooCommerceAPI(config, ApiVersionType.V2);
List orders = api.getAll(EndpointBaseType.ORDERS.getValue(), param);
The stack trace:
java.lang.RuntimeException: Can't parse retrieved object: {code=woocommerce_rest_authentication_error, message=Assinatura inválida - a assinatura fornecida não corresponde., data={status=401}}
at com.icoderman.woocommerce.DefaultHttpClient.getEntityAndReleaseConnection(DefaultHttpClient.java:127)
at com.icoderman.woocommerce.DefaultHttpClient.getAll(DefaultHttpClient.java:49)
at com.icoderman.woocommerce.WooCommerceAPI.getAll(WooCommerceAPI.java:44)
at br.com.xxxxxxxxxx.SeoxApplicationTests.apiCall(SeoxApplicationTests.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]401 invalid signature when doing a GET with "after" as parameter[/-][+]401 invalid signature when doing a GET with "after" or "before" as parameter[/+]ngocnd0242 commentedon Apr 15, 2020
@lucasmoriita I faced same as your issue, Have you fixed it? Could you help me fix it?
ngocnd0242 commentedon Apr 15, 2020
I'm trying to get the newest order after the time ISO8061 point...
ngocnd0242 commentedon Mar 12, 2021
@innoventry I took two days and I gave up and I changed my project to use laravel framework
ngocnd0242 commentedon Mar 12, 2021
someday, If I use java again, I will try it
ngocnd0242 commentedon Mar 12, 2021
@lucasmorita Please try it.
lucasmorita commentedon Mar 13, 2021
@ngocnd0242 Sorry for the delay in responding.
Actually, I gave up too, and it's been a while since I don't even touch at the code. But, as a workaround, I've decided to use OkHttp to make the requests as a workaround 😄
shakila-rajaiah commentedon Oct 13, 2021
This does not work as well.
ngocnd0242 commentedon Oct 13, 2021
@shakila-rajaiah you try it https://gist.github.com/JakeWharton/f26f19732f0c5907e1ab I think you should write reset + oauth1 yourself, I used by chilkat, It's works fine
Jookus commentedon May 8, 2022
Pull request #37 fixed it for me
lucasmorita commentedon Jul 1, 2022
Closing issue as it is fixed by #37