Error:
Invalid API key. Please see http://openweathermap.org/faq#error401 for more info
API calls responds with 401 error:
You can get the error 401 in the following cases:
- You did not specify your API key in API request.
- Your API key is not activated yet. Within the next couple of hours, it will be activated and ready to use.
- You are using wrong API key in API request. Please, check your right API key in personal account.
- You have free subscription and try to get access to our paid services (for example, 16 days/daily forecast API, any historical weather data, Weather maps 2.0, etc). Please, check your tariff in your personal account.
here are some steps to find problem.
1) Check if API key is activated
some API services provide key information in dashboard whether its activated, expired etc. openWeatherMap don’t.
to verify whether your key is working ‘MAKE API CALL FROM BROWSER’
api.openweathermap.org/data/2.5/weather?q=peshawar&appid=API_key
replace API_key with your own key, if you get data successfully then your key is activated otherwise wait for few hours to get key activated.
2) Check .env for typos & syntax
.env is file which is used to hide credentials such as API_KEY in server side code.
make sure your .env file variables are using correct syntax which is
NAME=VALUE
API_KEY=djgkv43439d90bkckcs
Enter fullscreen mode
Exit fullscreen mode
no semicolon, quotes etc
3) Check request URL
check request url where API call will be made , make sure
- It doesn’t have spaces, braces etc
- correct according to URL encoding
- correct according to API documentation
4) Debug using dotenv:
to know if you dotenv package is parsing API key correctly use the following code
const result = dotenv.config()
if (result.error) {
throw result.error
}
console.log(result.parsed)
Enter fullscreen mode
Exit fullscreen mode
this code checks if .env file variables are being parsed, it will print API_KEY value if its been parsed otherwise will print error which occur while parsing.
Hopefully it helps
@nicolasgarnier — resolved this myself please go ahead and close this issue
Replaced the API key and it worked
kevinrodriguez-io, GusGusGusGus, Blunderchips, narendavid, lifeanddeath, alanschwarz, bhaskar-nair2, lafeber, jorgegarba, jeremy0dell, and 132 more reacted with thumbs down emoji
cs353-g1, alefink, SubhamK95, A-Hosni, shenoykedar, pmvaldez, calvinf, MikeAlvarado, ykkim-git, ameddin73, and 3 more reacted with hooray emoji
I’m glad things worked out for you!
@nicolasgarnier
Hi Nicolas,
I’m quite new to firebase and would like to use authentication service for Google in a simple Angular2 test app.
But get the error: message: «Your API key is invalid, please check you have copied it correctly.»}
I would appreciate if you help me with it.
Regards,
Rozita
@nicolasgarnier I am getting these errors and i have checked and checked the API Key (even though i just copied and pasted it). Would could be causing this?
Regards,
Terry
I am also getting the error @terrysmyth is getting.
{code: "auth/invalid-api-key", message: "Your API key is invalid, please check you have copied it correctly."}
@Paloman fixed it by re-copying and pasting my API key, so try that
BraydenTW, cecimerelo, Dewaeq, kayacancode, suttapongw, kavehsaket, renanlopescoder, mustaquenadim, mnik01, rmiranda11, and 24 more reacted with thumbs down emoji
@eddyekofo94 I did :/ but it didn’t work… if you don’t mind me asking, are you using the google-services.json file to import the key? or directly through initialize app? also is this a native android app? thanks for all your help
@Paloman
Yes I am the google-services.json to import the key, I am using ASP.Net Core. But sorry I don’t know how it is implemented in Android.
I don’t know how it works on Android, if you’re still stuck I can go look it up later.
I am getting this error in core javascript.
I too am getting this error. Using Google Authentication works perfectly in develop but not in production after deploy. I’m at a loss to figure out why and/or where this needs to be configured.
gruckionvit and yenicelik reacted with heart emoji
gruckionvit and kiranm0698 reacted with rocket emoji
gruckionvit, yenicelik, and carlosjuniorx reacted with eyes emoji
Replaced the API key and it worked
Yes, but where?
I have the solution finally, just check how you have imported your firebaseConfig.js where you have initilize your firebase.
most of the case we export default firebaseConfig and import it as a object
import {firebaseConfig} from ‘./src/config/FirebaseConfig’; ===== Wrong Order
import FirebaseConfig from ‘./src/config/FirebaseConfig’; ===== Correct Order
gruckionvit, Kevinparra535, hebraheem, edgarcheverier, nzawirski, and sagar200027 reacted with thumbs down emoji
heyFahad, Olaide-EO, Nishchal-Phoenix, osmsey, and siam786 reacted with hooray emoji
BeniiSenpai, Ulkeshwani, aseet-dhale, honeybread, MatBitt, siam786, and Abdoul2020 reacted with heart emoji
Hello, this is my current config file
const config = { apiKey: process.env.API_KEY, authDomain: process.env.AUTH_DOMAIN, databaseURL: process.env.DBURL, projectId: process.env.PID, storageBucket: process.env.BUCKET, messagingSenderId: process.env.MSGID }; export default config;
and I am using it like so-
import firebase from "firebase/app"; import config from "./config"; firebase.initializeApp(config);
When I use the key string directly in the config file it works but not when it is used as my env variables..
aliparlakci, dilanSuraj, PukarHub, matchatype, and hanfeijiang reacted with thumbs down emoji
BeniiSenpai, AravindMurgan, bijaylaxmi123, and k1vz reacted with heart emoji
This may or may not be of any use to you, but are the env variables set in a .env
file in the root dir?
@bhaskar-nair2
My firebase.js
const config = {
apiKey: process.env.REACT_APP_API_KEY,
authDomain: process.env.REACT_APP_AUTH_DOMAIN,
databaseURL: process.env.REACT_APP_DATABASE_URL,
projectId: process.env.REACT_APP_PROJECT_ID,
storageBucket: process.env.REACT_APP_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_MESSAGING_SENDER_ID,
};
.env file
REACT_APP_API_KEY="key"
REACT_APP_AUTH_DOMAIN="domain"
REACT_APP_DATABASE_URL="url"
REACT_APP_PROJECT_ID="id"
REACT_APP_STORAGE_BUCKET="bucket"
REACT_APP_MESSAGING_SENDER_ID="id"
hueindahaus reacted with thumbs down emoji
yoavTaieb, EPIC448, kawerewagaba, and hammondwb reacted with hooray emoji
Had the same problem while building a react-native app:
Before:
export const firebaseConfig = { apiKey: "", etc etc };
After:
export default firebaseConfig = { apiKey: "", etc etc };
Replaced the API key and it worked
Where should I reset the API? I never assigned any authentication API anywhere in Firebase Console.
I’m using Flutter and received this error after migrate to AndroidX and switch to another notebook (the notebook where I did migration was working perfectly fine).
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(FirebaseException, An internal error has occurred. [ API key expired. Please renew the API key. ], null)
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(FirebaseException, An internal error has occurred. [ API key expired. Please renew the API key. ], null)
E/flutter ( 6509): #0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:564
E/flutter ( 6509): #1 MethodChannel.invokeMethod
package:flutter/…/services/platform_channel.dart:302
E/flutter ( 6509): <asynchronous suspension>
E/flutter ( 6509): #2 FirebaseAuth.signInWithCredential
package:firebase_auth/src/firebase_auth.dart:278
E/flutter ( 6509): <asynchronous suspension>
E/flutter ( 6509): #3 AuthProvider.signInFirebase
package:wavecheck/…/resources/auth_provider.dart:117
E/flutter ( 6509): <asynchronous suspension>
E/flutter ( 6509): #4 Repository.signInFirebase
package:wavecheck/…/resources/repository.dart:35
E/flutter ( 6509): <asynchronous suspension>
E/flutter ( 6509): #5 AuthenticationBloc.startApp.<anonymous closure>
package:wavecheck/…/blocs/authentication_bloc.dart:55
E/flutter ( 6509): <asynchronous suspension>
E/flutter ( 6509): #6 _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter ( 6509): #7 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 6509): #8 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
E/flutter ( 6509): #9 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
E/flutter ( 6509): #10 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
E/flutter ( 6509): #11 Future._complete (dart:async/future_impl.dart:473:7)
E/flutter ( 6509): #12 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter ( 6509): #13 _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter ( 6509): #14 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 6509): #15 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
E/flutter ( 6509): #16 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
E/flutter ( 6509): #17 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
E/flutter ( 6509): #18 Future._complete (dart:async/future_impl.dart:473:7)
E/flutter ( 6509): #19 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter ( 6509): #20 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:28:18)
E/flutter ( 6509): #21 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:294:13)
E/flutter ( 6509): #22 AuthProvider.signInGoogleSilently (package:wavecheck/src/resources/auth_provider.dart)
E/flutter ( 6509): <asynchronous suspension>
E/flutter ( 6509): #23 Repository.signInGoogleSilently
package:wavecheck/…/resources/repository.dart:33
E/flutter ( 6509): <asynchronous suspension>
E/flutter ( 6509): #24 AuthenticationBloc.startApp
package:wavecheck/…/blocs/authentication_bloc.dart:49
E/flutter ( 6509): #25 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
E/flutter ( 6509): #26 AuthenticationBloc.startApp
package:wavecheck/…/blocs/authentication_bloc.dart:43
E/flutter ( 6509): #27 main
package:wavecheck/main.dart:6
E/flutter ( 6509): #28 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:199:25)
E/flutter ( 6509): #29 _rootRun (dart:async/zone.dart:1124:13)
E/flutter ( 6509): #30 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 6509): #31 _runZoned (dart:async/zone.dart:1516:10)
E/flutter ( 6509): #32 runZoned (dart:async/zone.dart:1500:12)
E/flutter ( 6509): #33 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:190:5)
E/flutter ( 6509): #34 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300:19)
E/flutter ( 6509): #35 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)
E/flutter ( 6509):
Solved: Downloaded again google-services.json
@bhaskar-nair2 what was your solution? It seems that it’s not seeing my .env file
What I did
const firebaseConfig = {apiKey: '', etc, etc}
then I exported it
export deafault firebaseConfig
import
import firebaseConfig from './firebase'
This was in Angular 8
for my case I needed to restart my dev server since I entered them while it was already running
I have the solution finally, just check how you have imported your firebaseConfig.js where you have initilize your firebase.
most of the case we export default firebaseConfig and import it as a objectimport {firebaseConfig} from ‘./src/config/FirebaseConfig’; ===== Wrong Order
import FirebaseConfig from ‘./src/config/FirebaseConfig’; ===== Correct Order
This is the main problem. I was also trying to load my firebaseConfig
object at runtime, using the import()
function, at the time of initializing my FirebaseApp
. Now I don’t have this issue any more after importing the firebaseConfig
object at the top of the file, as described by @akashrauniyar35
I solved it moving env variables from
now.json -> env: {}
to .env file
This may or may not be of any use to you, but are the env variables set in a
.env
file in the root dir?@bhaskar-nair2
My firebase.js
const config = { apiKey: process.env.REACT_APP_API_KEY, authDomain: process.env.REACT_APP_AUTH_DOMAIN, databaseURL: process.env.REACT_APP_DATABASE_URL, projectId: process.env.REACT_APP_PROJECT_ID, storageBucket: process.env.REACT_APP_STORAGE_BUCKET, messagingSenderId: process.env.REACT_APP_MESSAGING_SENDER_ID, };
.env file
REACT_APP_API_KEY="key" REACT_APP_AUTH_DOMAIN="domain" REACT_APP_DATABASE_URL="url" REACT_APP_PROJECT_ID="id" REACT_APP_STORAGE_BUCKET="bucket" REACT_APP_MESSAGING_SENDER_ID="id"
Thanks, this is exactly my problem. I mistakenly put the .env file under src
folder.
If anyone having problem with the .env file in react project
2 things to keep in mind
-
Make extra sure that .env with key=value pairs is located at the root of the react project
-
After creating the .env RESTART dev server so that webpack picks up the new project changes. It will rebuild the project taking into accouunt the newly created .env file. Otherwise webpack has no information that you created this file.
deginmulbah and HALLneufmilles reacted with laugh emoji
deginmulbah, isabelmarh, and HALLneufmilles reacted with heart emoji
Replaced Api key in the json file and It worked, thnaks everyone
Another gotcha which got me:
My .env file is APPENDED in the pipeline. I forgot to add a newline (n
) to the end of the .env files that are already in my repo when I added something to it.
So, if you’re appending your .env
files in your pipelines which are already slightly populated in the repo itself, end in a newline.
In fact, end every file always with a newline. It’s a convention, and ignoring it apparently leads to bugs like this.
If anyone is still having trouble, what I found to work is initializing an app with a name i.e. not using the «[DEFAULT]» app and passing that app in whenever you require another firebase function. This helps prevent confusion of where which app with which key should be used.
Source of Firebase Javascript Documentation
import firebase from 'firebase'; import firebaseConfig from './firebaseConfig.js' var app = undefined; try { // Check if the app already exists app = firebase.app("NewName"); } catch(e) { app = firebase.initializeApp( firebaseConfig , "NewName"); } console.log( firebase.auth( app ).currentUser );
Thank you so much @abe157. You just saved me days.
I had the same issue. I solved it by doing:
- Make sure that your filename is .env.local instead of env.local (that dot is a lot imp :P).
- Your env file should be stored in root directory of your project instead of src or any other folder.
For some reason, it worked for me when I changed file’s name from .env.local
to .env
If you are using React, my problem was that I didn’t write .env variables with REACT_APP_(name of the variable)
Pretty funny but at the same time frustrating.
Make sure you are not using quotes or commas in your .env file. I had the same issue, but fixed it after removing quotes
Solution: change the version of google services at project level gradle and sync your project and reinstall.
classpath ‘com.google.gms:google-services:4.3.0’
I solved !
1º — I went to ‘Project Settings’ and there I created an application.
2º — As I was using Docker, my NuxtJS shared the application using my ip, so I put my ip in Firebase’s authorized domains.
Even if Dokcer puts my application in the localhost url.
for my case I needed to restart my dev server since I entered them while it was already running
thank you, it was working on my live server but not on localhost but restarting the server resolved my issue, twas this easy
if someone experiencing this with Nextjs and firebase this solution may help
in next.config.js add this
module.exports = {
env : {
FIREBASE_API_KEY: process.env.apiKey,
AUTH_DOMAIN: process.env.authDomain,
PROJECT_ID: process.env.projectId,
STORAGE_BUCKET: process.env.storageBucket,
MESSAGING_SENDER_ID: process.env.messagingSenderId,
APP_ID: process.env.appId,
}
}
then in your firebase config
const firebaseConfig = {
apiKey: process.env.FIREBASE_API_KEY,
authDomain: process.env.AUTH_DOMAIN,
projectId: process.env.PROJECT_ID,
storageBucket: process.env.STORAGE_BUCKET,
messagingSenderId: process.env.MESSAGING_SENDER_ID,
appId: process.env.APP_ID,
}
then restart the server, it should work.
krishneup, juliosouzam, datsfilipe, artusi-io, cchanningallen, and dkorsakas reacted with hooray emoji
dkorsakas reacted with heart emoji
If people are still experiencing this issue, I had the same problem when using a .env.local file for all of the info for firebase what I had to do was stop the test site and restart it again so it realises there’s a new .env file I don’t know why but it worked so
Hello everyone I am actually having this problem for some reason firebase works locally but once deployed I get this error {code: «auth/invalid-api-key», message: «Your API key is invalid, please check you have copied it correctly.»} no really sure what to do?
here is my config file
import app from 'firebase/app' import 'firebase/storage' const config = { apiKey: process.env.REACT_APP_API_KEY, authDomain: process.env.REACT_APP_AUTH_DOMAIN, databaseURL: process.env.REACT_APP_DATABASE_URL, projectId: process.env.REACT_APP_PROJECT_ID, storageBucket: process.env.REACT_APP_STORAGE_BUCKET, messagingSenderId: process.env.REACT_APP_MESSAGING_SENDER_ID, }; const firebase = app.initializeApp(config) export default firebase
and here is my .env.development
REACT_APP_API_KEY=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_AUTH_DOMAIN=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_DATABASE_URL=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_PROJECT_ID=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_STORAGE_BUCKET=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_MESSAGING_SENDER_ID=xxxxxxxxxxxxxxxxxxxxxx //everything is correct ! what is going on
and I am importing the config file correctly
import firebase from './index'
I’m having this exact same issue. @HassenH1, were you ever able to fix this?
I have same error but only in test, I have tried all solutions from here, but it’s not helping. I’m using Jest
I had the same issue. I solved it by doing:
- Make sure that your filename is .env.local instead of env.local (that dot is a lot imp :P).
- Your env file should be stored in root directory of your project instead of src or any other folder.
This worked for me too… kindly follow the above steps for react app and restart your local server… Thanks
In case anybody is using Github’s action to deploy to Firebase:
You most probably (.git)ignoring the .env file so Github builds your solution without those credentials. My solution was to add SpicyPizza/create-envfile to my workflow, while the ENV config was saved securely in my repo’s Actions secrets
In case you are using NextJS be aware that you need to add the NEXT_PUBLIC_
prefix to the .env vars so they are exposed to the browser, your .env.local
would look something like this
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=something.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=yourapikey
NEXT_PUBLIC_FIREBASE_PROJECT_ID=yourprojectname
when i pulled my repo, there was only a .venv.deploy, adding a .env.local with the correct config fixed my issue
@code-vagabond doesn’t seems a good idea to make public your api keys
After spending hours here nothing worked for me except direct adding the string into the firebaseConfig, even checking with console the data as string was there but the sdk continues to complaining and I didn’t want to expose my keys on the file.
But actually find a simple way just apiKey: String(process.env.NEXT_PRIVATE_APIKEY),
for some reason even that key being a string before String() now it works.
Another information is this was a problem only with auth sdk, firestore sdk alone works fine without any «hack»
@octavioamu hi, yes in my case I only needed my public API key for Firebase initialisation which is obviously ok to share. In your case you are trying to initialise firebase-admin I imagine
@code-vagabond true, Im not using the admin just firestore + auth but yes I guess you are controlling the access via domain allowed, but I prefer to not direct expose it on the code + manage the keys by .env file for dev vs prod scenarios.
k14lb3
added a commit
to k14lb3/picpic
that referenced
this issue
Mar 14, 2022
In case you are using NextJS be aware that you need to add the
NEXT_PUBLIC_
prefix to the .env vars so they are exposed to the browser, your.env.local
would look something like thisNEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=something.firebaseapp.com NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=yourapikey NEXT_PUBLIC_FIREBASE_PROJECT_ID=yourprojectname
thanks!
Hello everyone I am actually having this problem for some reason firebase works locally but once deployed I get this error {code: «auth/invalid-api-key», message: «Your API key is invalid, please check you have copied it correctly.»} no really sure what to do?
here is my config fileimport app from 'firebase/app' import 'firebase/storage' const config = { apiKey: process.env.REACT_APP_API_KEY, authDomain: process.env.REACT_APP_AUTH_DOMAIN, databaseURL: process.env.REACT_APP_DATABASE_URL, projectId: process.env.REACT_APP_PROJECT_ID, storageBucket: process.env.REACT_APP_STORAGE_BUCKET, messagingSenderId: process.env.REACT_APP_MESSAGING_SENDER_ID, }; const firebase = app.initializeApp(config) export default firebase
and here is my .env.development
REACT_APP_API_KEY=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_AUTH_DOMAIN=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_DATABASE_URL=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_PROJECT_ID=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_STORAGE_BUCKET=xxxxxxxxxxxxxxxxxxxxxx REACT_APP_MESSAGING_SENDER_ID=xxxxxxxxxxxxxxxxxxxxxx //everything is correct ! what is going on
and I am importing the config file correctly
import firebase from './index'
I’m having this exact same issue. @HassenH1, were you ever able to fix this?
same here, any updates on this problem?? @PurplePineapple123
saintaze
Yes thanks saintaze, that worked for me.
Using NextJS with Firebase v9. Here is my solution..
So, I have the same problem with the .env variables not working, but it does work when hard coding the string. I noticed in the .env they are single quoted when evaluated. This is dumb, but I just concatenated an empty string to the end of each process.env.VAR like so:
apiKey: process.env.API_KEY + «»;
for me it appears the difference was the api key as a single quote string ‘my-key’ and a double quote string «my-key». I think appending an empty string to the end is dumb and would love a recommendation.
Thanks @RobLMartin. your hacky solution worked for me…
Thanks @RobLMartin. your hacky solution worked for me…
Wish it wasn’t a thing.
Hello, this is my current config file
const config = { apiKey: process.env.API_KEY, authDomain: process.env.AUTH_DOMAIN, databaseURL: process.env.DBURL, projectId: process.env.PID, storageBucket: process.env.BUCKET, messagingSenderId: process.env.MSGID }; export default config;and I am using it like so-
import firebase from "firebase/app"; import config from "./config"; firebase.initializeApp(config);When I use the key string directly in the config file it works but not when it is used as my env variables..
I also faced the same problem. When I used the key string directly it works but it didn’t work on environment variables.
It shows Uncaught FirebaseError: Firebase: Error (auth/invalid-api-key)
error.
But, this error I solved after relocating my .env.local
file in the root folder from the src folder.
You could try this way to solve this error.
oooh!!! I restart my project, and it works!
If you’re like me, I had this issue when deploying an app to Heroku. There were no issues with my code, it’s that Heroku expects you to have your config vars set on the Heroku side, so go into the panel and set your config vars in the Settings section. No need to change code or restart app, just redeploy to Heroku once the config vars are set.
Here are descriptions of the most common errors when working with or connecting to Binance Futures / Binance Spot in Quantower platform
Here is the list of the most common errors and issues with Binance Futures /Spot connections:
Error «Invalid API-key, IP, or permissions for action»
Error «Invalid API-key, IP, or permissions for action»
«Invalid API Key» error occurs for several reasons:
-
a trader did not enable Future Trading in the personal account on the Binance website
-
API Keys were not copied correctly.
If you sure that everything is correct, please recreate the new keys and the problem is resolved. It’s better to recreate it through another browser (sometimes errors occur when creating through Google Chrome).
To solve it, please check that your API Key has permissions for Futures trading. Go to Binance official website > Under your account select API management > check & activate Futures Trading
Activate the setting for Futures Trading
Error «API key format invalid»
Error «API key format invalid»
Check that your API Key and API Secret are correct.
Error «Timestamp for this request was 1000ms ahead of the server’s time»
Error «Timestamp for this request was 1000ms ahead of the server’s time»
«TimeStamp» error occurs when the time on the Binance server does not match the time on the user’s computer.
Binance Futures error in Quantower — Timestamp for the request
To solve it, please, go to Windows Settings > Time & Language > and click on Sync Now button.
Error «Timestamp for this request is outside of the recvWindow»
Error «Timestamp for this request is outside of the recvWindow»
The platform synchronizes time with the Binance exchange during the connection. If the desynchronization reaches a certain limit, then any (authorized) requests will display this error.
To solve it, please, go to Windows Settings > Time & Language > and click on Sync Now button.
Error «Order’s notional must be no smaller than 5.0 (unless you choose to reduce only)
Error «Order’s notional must be no smaller than 5.0 (unless you choose to reduce only)
As of February 24, 2021 the value of the perpetual futures order must be at least $5. If it is less than that, the order will be rejected. If you encounter this error, increase the volume you are placing so that it is greater than or equal to $5.
Example: When opening 0.001 ETH, the value of the order is greater than $5, so it will be placed. An order for 1 ANK is worth less than $5, so it will be rejected.
Error «Margin is insufficient»
Error «Margin is insufficient»
This error occurs when trying to place the order. Please check your wallet balance and make sure that there is enough coin to make a trade. When trading USDS-M futures on Binance Futures, the wallet account must have USDT tokens.
Error «Too many new orders»
Error «Too many new orders»
Limit on the number of orders has been reached (usually this is a limit on a particular instrument). There may be a limit on the instrument itself, or a limit on orders sent in a certain period (for example, 10 orders per second — spam).
Error «Balance is insufficient»
Error «Balance is insufficient»
This error occurs when you don’t have enough funds on the balance. Check your wallet balance and make sure you have enough coins for the transaction.
Error «This listenKey does not exist»
Error «This listenKey does not exist»
This error occurs when a trader connects to Binance exchange with the same API Key on various platforms. Each platform must have its own API Key. Generate a new API key for Quantower platform.
An error has occurred: «I can’t close the position. Request was executed partially — the value of the open position is less than $5.
An error has occurred: «I can’t close the position. Request was executed partially — the value of the open position is less than $5.
This situation is connected with the rule of exchange Binance Futures about the minimum order volume from $5. You may close a position worth less than $5 using the following methods:
1. Buy up to minimum volume and place limit order to close position.
2. Place a pending stop order to close the position with a volume equal to the position.
3. Set Stop-Loss or Take-Profit on the server-side.
4. Close the order through Binance Futures website.
Error «Too much requests weight used; current limit is 1200 request weight per 1 minute. Please use the websocket for live updates to avoid polling the API»
Error «Too much requests weight used; current limit is 1200 request weight per 1 minute. Please use the websocket for live updates to avoid polling the API»
Binance has set a limit of requests for a certain time (e.g., sending an order, requesting an instrument table). If the limit is exceeded, an appropriate message may appear, or the IP will be banned for making requests for some time.
Error «Parameter ‘start time’ is invalid»
Error «Parameter ‘start time’ is invalid»
This error does not affect the correct data loading or trading. The message appears when switching to a symbol that has not yet been loaded in the current active session.
Error «Signature for this request is not valid»
Error «Signature for this request is not valid»
Usually, the error indicates that the keys are not entered correctly. It is likely that the API Key/Secret key is entered correctly, but maybe «broken». Check if the APIKey and APISecret are entered correctly or recreate the keys.
The API Key Authentication is one of the simplest method to protect WordPress REST APIs. Once you generate the Bearer Token / API Key you can use it to secure your WordPress page / post. Users who have this Bearer Token can easily access WordPress REST APIs.
In every REST API request it should contain a Authorization Header or you can set a custom Header which will contain a Bearer Token type and the API Key value. So, whenever a client application will make a request to get resources it must contain the Header which have a Valid API Key to authenticate. You can check out the sample request to get all WordPress posts / blogs.
User specific API Key authentication
In default API Key authentication, only GET request can be made, if POST request is to be made, the user needs to be authenticated in WordPress and should have the capabilities to perform those actions. This is where User specific API Key authentication comes into play. Based on the capabilities of the user, he can perform the actions.
Sample Request
Request: GET /wp-json/wp/v2/posts
Header: Authorization : Bearer <token>
The Header is explained below.
-
Authorization :
The HTTP Authorization request header contains the credentials or token type and token value to authenticate a user agent with a server, usually after unsuccessful authentication the server has responded with a 401 Unauthorized status. -
Bearer <token-value> :
The Bearer <token-value> is created by the Authentication server. When a client application request the authentication server then server authenticate that token and give response to client application accordingly.
- cURL
- Postman
curl -H "Authorization:Bearer <token-value>" -X GET http://<wp_base_url>/wp-json/wp/v2/posts
Click here to download POSTMAN collection export
The server replies with the requested data as the members of a JSON object.
Success Response
Code | Status | Description |
---|---|---|
200 | SUCCESS | Example model: [{ «id»:1, «guid»:{ «rendered»:»http://<wp_base_url>/?p=1″ }, «slug»:»hello-world», «status»:»publish», «type»:»post», «link»:»http://<wp_base_url>/hello-world/», «title»:{ «rendered»:»Hello World» }, «content»:{ «rendered»:»<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!</p>», «protected»:false },… }] |
Error Response
Code | Error | Description |
---|---|---|
401 | INVALID_API_KEY | You will get this error when you have put an invalid API Key or expired API Key.
Example Model: |
401 | MISSING_AUTHORIZATION_HEADER | You will get this error whenever you don’t send Header in the API request or It was removed by your server due to some reasons.
Example Model: NOTE — This error may occur because of server environment, your server may removed your Authorization header due to security reasons. — If you are using Apache server then put the below line in your htaccess file after the RewriteBase. — If you are using NGINX server then put the below line in your conf file. |
401 | INVALID_AUTHORIZATION_HEADER_TOKEN_TYPE | You will get this error whenever you send the Authorization header but in header you are sending the wrong token type.
Example Model: |