Skip to content

Updated MexcAuthenticationProvider to skip header creation for unauthenticated requests#27

Open
nils2525 wants to merge 1 commit intoJKorf:mainfrom
nils2525:feature/AuthFix
Open

Updated MexcAuthenticationProvider to skip header creation for unauthenticated requests#27
nils2525 wants to merge 1 commit intoJKorf:mainfrom
nils2525:feature/AuthFix

Conversation

@nils2525
Copy link
Copy Markdown
Contributor

@nils2525 nils2525 commented Apr 16, 2025

The following test failed on the second GetKLinesAsync() call:

var client = new MexcRestClient(null, new TestLoggerFactory(), Options.Create<MexcRestOptions>(new()));
// Success
var successResponse = await client.SpotApi.ExchangeData.GetKlinesAsync("BTCUSDT", Mexc.Net.Enums.KlineInterval.OneMinute, limit: 2);

client.SetApiCredentials(new("x", "y"));
// Failed
var failedResponse= await client.SpotApi.ExchangeData.GetKlinesAsync("BTCUSDT", Mexc.Net.Enums.KlineInterval.OneMinute, limit: 2);

Error Message: Error response: [ServerError] 700004: Mandatory parameter 'signature' was not sent, was empty/null, or malformed. , 99 bytes received in 256ms

I noticed that the X-MEXC-APIKEY header was set even though authentication was not required for the request. My change fixes the error. I hope that there was no specific reason that the key was set before the auth check.

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

Successfully merging this pull request may close these issues.

1 participant