jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 768 forks source link

Signature for this request is not valid error on withdrawal operation #413

Open PaulMuller opened 4 years ago

PaulMuller commented 4 years ago

few days ago start to receive this error when try to withdraw from binance.

Solved by manyally replace signature from URL into form body.


const signedRequest = ( url, data = {}, callback, method = 'GET', noDataInSignature = false ) => {
...
 if ( method === 'POST' ) {
            let opt = reqObjPOST(
                url,
                data,
                method,
                Binance.options.APIKEY
            );
            opt.form.signature = signature
            // + '?signature=' + signature
            // let opt = reqObjPOST(
            //     url + '?signature=' + signature,
            //     data,
            //     method,
            //     Binance.options.APIKEY
            // );
            // console.log(opt)
            proxyRequest( opt, callback );

...
jaggedsoft commented 4 years ago

thank you for sharing your solution, curious how the problem is only on withdraw. cheers!

This did not break anything else? Nice improvement, thanks again.

if ( method === 'POST' ) {
    let opt = reqObjPOST(
        url,
        data,
        method,
        Binance.options.APIKEY
    );
    opt.form.signature = signature;
    proxyRequest( opt, callback );
}
samcayford commented 4 years ago

Also getting this error with marketSell. This change doesn't fix it for me.

Note: I had to change the URLs as I'm using binance.us, not sure if that has any bearing here.

2pd commented 4 years ago

If possible, please switch to

POST /sapi/v1/capital/withdraw/apply

https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi

DeveloperAriana commented 4 years ago

I have the same problem, this worked for me, but I wonder when they will upload the fix to npm @jaggedsoft

DeveloperAriana commented 4 years ago

hola @DeveloperAriana, ¿puedes describir cómo lo arreglaste ? Apliqué el cambio de código pero no funcionó para mí.

Hello, I made the same modification that I comment @PaulMuller , I went to the node-modules folder of my project, specifically node-binance-api and I modified the file called node-binance-api.js. Attached image of how the file is finally api

If this still doesn't work for you, make sure your keys are correct

teramit commented 4 years ago

@DeveloperAriana, i did exactly same and my keys are true but not worked :( if i change like this withdraw fails and even trade fails. @jaggedsoft edit: ok it worked for me too, seems like i wasnt using last version of this script so after update and using this revision now withrawals are working great, thanks

b-m-9 commented 4 years ago

This fix work for me:

 opt.form.signature = signature;

Current version .withdraw has an error with signature.

"node-binance-api": "^0.11.6",