Skip to content

Credentials is not set properly. #572

Description

@marhninemohammed

Hi there, I got this amazing library but I think it misses some critical parts.
One of them is setting credentials.
I've tried this way:

if (ccapi::UtilSystem::getEnvAsString("BYBIT_API_KEY").empty())
{
  std::cerr << "Please set environment variable BYBIT_API_KEY" << std::endl;
  EXIT_FAILURE;
}
if (ccapi::UtilSystem::getEnvAsString("BYBIT_API_SECRET").empty())
{
  std::cerr << "Please set environment variable BYBIT_API_SECRET" << std::endl;
  EXIT_FAILURE;
}

credentials.api_key["BYBIT_API_KEY"] = ccapi::UtilSystem::getEnvAsString("BYBIT_API_KEY");
credentials.secret_key["BYBIT_API_SECRET"] = ccapi::UtilSystem::getEnvAsString("BYBIT_API_SECRET");

configs_->setCredential(credentials.api_key);
configs_->setCredential(credentials.secret_key);

But it it returns with 401 error:

Message [
type = RESPONSE_ERROR,
recapType = UNKNOWN,
time = 1970-01-01T00:00:00.000000000Z,
timeReceived = 2026-06-14T02:11:00.397618660Z,
elementList = [
Element [
nameValueMap = {
ERROR_MESSAGE = {"label":"INVALID_KEY","message":"Invalid key provided"},
HTTP_STATUS_CODE = 401
}
]
],
correlationIdList = [ 0 ],
]

provided that the keys is valid and tested.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions