using binance-connector-node testnet always respond with 401
example:
import { Spot } from '@binance/connector'
// apiKey and apiSecret from https://testnet.binancefuture.com
const apiKey= "testnetApiKey";
const apiSecret= "testnetApiSecret";
const spotClient = new Spot(apiKey, apiSecret, {
baseURL: 'https://testnet.binance.vision',
})
spotClient.account().then( console.log );
response:
{
"message": "Request failed with status code 401",
"name": "Error",
"stack": "Error: Request failed with status code 401\n at createError (node_modules/axios/lib/core/createError.js:16:15)\n at settle (node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (node:events:402:35)\n at IncomingMessage.emit (node:domain:475:12)\n at endReadableNT (node:internal/streams/readable:1343:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)",
"config": {
"url": "/api/v3/account?timestamp=1640794495823&signature=****************************************************************",
"method": "get",
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"X-MBX-APIKEY": "****************************************************************",
"User-Agent": "@binance/connector-node/1.6.0"
},
"baseURL": "https://testnet.binance.vision",
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
}
},
"response.data": {
"code": -2015,
"msg": "Invalid API-key, IP, or permissions for action."
}
}