Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Alifar opened this issue May 19, 2021 · 2 comments
Open

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

Alifar opened this issue May 19, 2021 · 2 comments

Comments

@Alifar
Copy link

Alifar commented May 19, 2021

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

@Alifar Alifar closed this as completed May 21, 2021
@Alifar Alifar reopened this May 23, 2021
@timrijkse
Copy link

I'm having the same issue with all private methods (balance, orders etc)

@niodad
Copy link

niodad commented Jan 10, 2022

I think you need the application/json header, that solved this for me

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

No branches or pull requests

3 participants