XChange
XChange copied to clipboard
OKEX, OKX, getting 50113:Invalid Sign
Hi.
Getting a lot of
Caused by: 50113:Invalid Sign at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:128) at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:291)
Some stuff goes through. Other stuff dies like that ^^^.
This is how their API signs: https://github.com/jane-cloud/Open-API-SDK-V5/blob/main/okex-java-sdk-api-v5/src/main/java/com/okex/open/api/client/APIHttpClient.java
private String sign(final Request request, final String timestamp) {
final String sign;
try {
sign = HmacSHA256Base64Utils.sign(timestamp, this.method(request), this.requestPath(request),
this.queryString(request), this.body(request), this.credentials.getSecretKey());
//System.out.println("签名字符串:"+timestamp+this.method(request)+this.requestPath(request)+this.queryString(request)+this.body(request));
} catch (final IOException e) {
throw new APIException("Request get body io exception.", e);
} catch (final CloneNotSupportedException e) {
throw new APIException("Hmac SHA256 Base64 Signature clone not supported exception.", e);
} catch (final InvalidKeyException e) {
throw new APIException("Hmac SHA256 Base64 Signature invalid key exception.", e);
}
return sign;
}
Yes, I synchronized the server's clock with an atomic clock. Don't know if THEY have though.