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

INVALID API KEYS 10100 #575

Open
4 tasks
Leonardll opened this issue Oct 31, 2021 · 0 comments
Open
4 tasks

INVALID API KEYS 10100 #575

Leonardll opened this issue Oct 31, 2021 · 0 comments

Comments

@Leonardll
Copy link

Issue type

  • bug
    data: [ 'error', 10100, 'apikey: invalid' ]
  • missing functionality
  • performance
  • feature request
    Hi guys

Brief description

i' am trying my first authentication to log user info in terminal. i have the correct api key but it does not work.
Can someone explain me what i do wrong please? thanks

Steps to reproduce

const { WSv2 } = require('bitfinex-api-node')
const ws = new WSv2({ transform: true })

const crypto = require('crypto-js') // Standard JavaScript cryptography library
const WebSocket = require('ws') // Websocket library for Node

const apiKey = '' // Users API credentials are defined here
const apiSecret = ''

const authNonce = Date.now() * 1000 // Generate an ever increasing, single use value. (a timestamp satisfies this criteria)
const authPayload = 'AUTH' + authNonce // Compile the authentication payload, this is simply the string 'AUTH' prepended to the nonce value
const authSig = crypto.HmacSHA384(authPayload, apiSecret).toString(crypto.enc.Hex) // The authentication payload is hashed using the private key, the resulting hash is output as a hexadecimal string

const payload = {
apiKey, //API key
authSig, //Authentication Sig
authNonce,
authPayload,
event: 'auth', // The connection event, will always equal 'auth'
//dms: 4, // Optional Dead-Man-Switch flag to cancel all orders when socket is closed
//filter: [] // Optional filter for the account info received (default = everything)
}

const wss = new WebSocket('wss://api.bitfinex.com/ws/2') // Create new Websocket

wss.on('open', () => wss.send(JSON.stringify(payload)))

wss.on('message', (msg) => { // The 'message' event is called whenever the ws recieves ANY message
let response = JSON.parse(msg)
console.log(msg)
})

const apiPath = 'v2/auth/r/info/user'
const axios = require('axios');

axios(https://api.bitfinex.com/${apiPath}, {
method: 'POST',
body: JSON.stringify({
}),
headers: {
/* auth headers */
}
})
.then(res => res.json())
.then(json => console.log(json))
.catch(err => {
console.log(err)
})-

Additional Notes:
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

1 participant