Skip to content

errorCode: 301, error: 'API Key must be of length 64.' #13

@Alifar

Description

@Alifar

I have tripple checked my API key and secret and are correct but still gives me the following error:
errorCode: 301, error: 'API Key must be of length 64.'

const createSignature = function (timestamp, method, url, body) {
let string = timestamp + method + '/v2' + url;
 if (Object.keys(body).length !== 0) {
string += JSON.stringify(body);
}
let signature = crypto
.createHmac('sha256', process.env.API_SECRET)
.update(string)
.digest('hex');
return signature;
};
var sig = createSignature(Date.now(), 'GET', '/balance', {});

bitvavo.balance(
{
  headers: {
    'Bitvavo-Access-Key': process.env.API_KEY,
    'Bitvavo-Access-Signature': sig,
    'Bitvavo-Access-Timestamp': Date.now(),
    'Bitvavo-Access-Window': 10000,
  },
},
(error, response) => {
  if (error === null) {
    console.log(response);
  } else {
    console.log(error);
  }
});

Note: even without setting the headers it gives me the same error

bitvavo.balance({}, (error, response) => {
  if (error === null) {
    console.log(response);
  } else {
    console.log(error);
  }
});

I can access all other endpoints from the API just fine

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