Closed overstartup closed 1 year ago
I have the same error on private requests, for example
2023/04/14 01:21:45:831 | Information | OKX RestApi | [10] Creating request for https://aws.okx.com/api/v5/trade/order 2023/04/14 01:21:46:320 | Warning | OKX RestApi | [10] Error received in 481ms: {"msg":"Request header OK-ACCESS-KEY can not be empty.","code":"50103"}
All credentials provided to the API are correct. I just switched to the new version from OKEx.Net, and there were no such errors in the older package, I used it a few hours ago.
I'd appreciate if you check this issue and publish the solution.
It seems the error is in Authentication/OkxAuthenticationProvider.cs, function AuthenticateRestApi(). In the first check point (line 22) we can see
if (!signed || !options.SignPublicRequests)
must be
if (!signed && !options.SignPublicRequests)
Yes It's my mistake. I'm updating it now. I'll release new version this evening
I upgrade to a new version, but I have this error. my configuration:
23/04/13 20:46:47:908 | Information | OKX RestApi | [1] Creating request for https://www.okx.com/api/v5/account/balance 2023/04/13 20:46:47:911 | Trace | OKX RestApi | [1] Sending GET signed request to https://www.okx.com/api/v5/account/balance with headers Accept=[application/json] 2023/04/13 20:46:48:143 | Warning | OKX RestApi | [1] Error received in 229ms: {"msg":"Request header OK-ACCESS-KEY can not be empty.","code":"50103"}
other methods:
2023/04/13 20:58:14:223 | Information | OKX RestApi | [3] Creating request for https://www.okx.com/api/v5/account/positions-history 2023/04/13 20:58:14:226 | Trace | OKX RestApi | [3] Sending GET signed request to https://www.okx.com/api/v5/account/positions-history?instId=BTC-USDT-SWAP&instType=SWAP&limit=2 with headers Accept=[application/json] 2023/04/13 20:58:14:491 | Warning | OKX RestApi | [3] Error received in 262ms: {"msg":"Request header OK-ACCESS-KEY can not be empty.","code":"50103"}
2023/04/13 20:58:14:737 | Information | OKX RestApi | [1] Creating request for https://www.okx.com/api/v5/trade/order 2023/04/13 20:58:14:741 | Trace | OKX RestApi | [1] Sending POST signed request to https://www.okx.com/api/v5/trade/order with request body '{"ccy":"USDT","clOrdId":"638170162944971801","instId":"BTC-USDT-SWAP","ordType":"market","posSide":"long","side":"buy","sz":"100","tag":"538a3965e538BCDE","tdMode":"cross"}' with headers Accept=[application/json] 2023/04/13 20:58:15:012 | Warning | OKX RestApi | [1] Error received in 268ms: {"msg":"Request header OK-ACCESS-KEY can not be empty.","code":"50103"}
I checked your example, too, it has the same issue. I haven't check all method yet. Please check to find all issues.