binance / binance-api-postman

Postman collection for Binance Public API, including spot, margin, futures, etc.
MIT License
1.34k stars 893 forks source link

Postman not setting BInance environment variables #180

Closed djp9192 closed 2 years ago

djp9192 commented 2 years ago

Hi, i've used Postman for Binance for some time successfully, but not for a while ... and now all requests which require an API key fail: "code": -2008, "msg": "Invalid Api-Key ID." In the code say for {{url}}/sapi/v1/capital/config/getall?timestamp={{timestamp}}&signature={{signature}} the environment variable is not being set properly:: myHeaders.append("X-MBX-APIKEY", "api-key"); And when i hover on the environment variable in the Header section of the API call, you can see that the current value is not set.

But in the Environment, the variable binance-api-key has the correct initial value and current value set.

p.s. i've reinstalled POSTMAN for Desktop, and i've deleted and reimported the Binance SPOT collection and the Environment.

Any ideas?

chairz-2 commented 2 years ago

From the Postman UI, navigate to Environment and make sure that the Initial Value and Current Value are set with your API Key correctly. Try to create a new API Key if it fails again.

djp9192 commented 2 years ago

Yes, as mentioned, in the Environment, the variable binance-api-key has the correct initial value and current value set.

I did try many different sets of API keys, before i realized that that wasn't helping, since the API parms and header weren't using the refreshed environment variable values.

chairz-2 commented 2 years ago

https://github.com/postmanlabs/postman-app-support/issues/6001#issuecomment-1164603270

There is an issue thread for this on postman. Try and see if this fixes your problem.

djp9192 commented 2 years ago

Thanks, but it doesn't help. I've tried all the suggestions already, I've signed out & in, uninstalled and reinstalled postman, deleted and reimported the collection and environment, and the bug is still there.

2pd commented 2 years ago

Go to the postman menu: View -> Show Postman Console Then you will see the raw logs of each request. You should be able to see what exactly API key was sent in the request header.

djp9192 commented 2 years ago

Yes, thanks i've checked that before. From the console it also shows that no value is being set for X-MBX-APIKEY (from the environment variable which does have a correct value): Request Headers Content-Type: application/json X-MBX-APIKEY: api-key

2pd commented 2 years ago

image

Please check the environment file and also the header in each request. Make sure you have the SAME settings as in the screenshot.

The header setting comes from the post collection. Maybe it worths to download the collection and import it again.

djp9192 commented 2 years ago

Yes thanks, the header is exactly as per the screen shot, and the environment variable is set for that variable. header

But when you hover you see the header variable doesn't contain the expected value.

I've deleted and reimported the collection and environment several times, and reinstalled postman, but same problem ever time.

2pd commented 2 years ago

that's weird. Maybe you can try setup the environment file again? Or maybe reinstall the postman. Not sure why the binance-api-key is not set.

2pd commented 2 years ago

Please open new issue if you still has any difficult.