AxiosError: Request failed with status code 401

Now we have using this code, but can’t able to access the supported assets. Instead of getting error like

AxiosError: Request failed with status code 401

const apiSecret = fs.readFileSync(path.resolve(__dirname, “../fireblocks_secret.key”), “utf8”);
const apiKey = APIKEY;
const BASE_URL = “https://sandbox-api.fireblocks.io/v1/”;
const fireblocks = new FireblocksSDK(apiSecret, apiKey, BASE_URL);

async function test() {
try {
const supportedAssets = await fireblocks.getSupportedAssets();
console.log(supportedAssets);
} catch(e) {
console.error(Failed: ${e} *****************);
}
}
test()

Guide us

Hi @pemaju02 welcome to the Fireblocks Community!

Can you confirm that you have followed these steps in generating a CSR file and corresponding secret.key file?

Yes, followed, by using automatic CSR file and then Role as NCW admin. But same error message

And one more thing, Is approval must for generated API Keys ?.

Thanks in advance.

Can you clarify what you mean by “is approval must for generated API keys?”

When adding new user to a workspace, be it human or API user, the workspace owner and admin quorum must both give their approvals.

In the documentation, mention like this

So can’t able to approve the key using sandbox account ?

Since sandbox users do not have access to the Fireblocks app on a mobile device, they will not receive an additional notification to approve new users or API keys being added to a workspace.
Instead, users and API keys are automatically approved.

Please see this page for more information between the different workspace environments.

Thank you for reply.

Privatekey also stored in my project and added the API but response always throws “AxiosError: Request failed with status code 401”,

Can you guide me