This tutorial helps you keep your API key out of your code repository. That said, if you want to learn how to keep your API key completely out of your frontend code, you will want to watch my tutorial about setting up a NodeJS API Key Relay: kzbin.info/www/bejne/q5ycoamfrtulqsk
@sextronnics3 жыл бұрын
You can also use a sql server in another data center install sql php and apache and something cool to encript/decript stuff. encrypt the keys in a very secure way so it can be decrypted by your machine only, store the encripted keys in SQL database write some php allow your domains that use any of the keys only to access your servers others should not get an answer from the server. From here there are multiple methodes on how you can or might want to use the keys including decoding and sending it to some secret place on your websites server over end to end encrypted connection and use it on your webserver. your websites webserver should delete the file when it's no longer needed . Yes it's not as fast as what you do but it is very secure and not easy to find the data and even if someone is able to get access to the database they are not able to crack the keys and more important if they crack the keys most people do not know how to use them and what the keys should be used for... maybe you want to try something like this, it's what I did 15 years ago and it is still very secure however if the hackers want to there is no system secure enough but this is hard to hack... Good luck and happy coding ! Best Regards,
@harlemjulian293 жыл бұрын
I guess it is pretty off topic but does anybody know a good site to stream new series online?
@korbinkylo19213 жыл бұрын
@Harlem Julian Flixportal xD
@harlemjulian293 жыл бұрын
@Korbin Kylo Thank you, I went there and it seems like a nice service =) I really appreciate it!
@korbinkylo19213 жыл бұрын
@Harlem Julian No problem :)
@HideBuz Жыл бұрын
You rock! Your long tutorials are awesome!
@DaveGrayTeachesCode Жыл бұрын
Thank you!
@danielvega646 Жыл бұрын
I will never forget you, Dave Gray. Thank you so much for being so cool! Greetings from Colombia.
@zenguitarankh Жыл бұрын
"Oh man....what's this github guardian email?...oh of course...I exposed the apikey so it's flagging me....time to search around for how I deal with this.....I bet it's gonna be hard to find someone with my exact situation....with github with netlify.....with a weather app....." (Dave has entered the chat) Thanks once again man.
@DaveGrayTeachesCode Жыл бұрын
You're welcome! 🚀
@eliz9644 жыл бұрын
You have such good content. You deserve way more subscribers.
@DaveGrayTeachesCode4 жыл бұрын
Thank you!
@eliodrallag48063 жыл бұрын
This is what I've been looking for. Thank you
@DaveGrayTeachesCode3 жыл бұрын
You're welcome. This solution will keep the key out of GitHub. If you want to keep it out of your code completely, consider a bit more in-depth solution like this one: kzbin.info/www/bejne/q5ycoamfrtulqsk
@ritakriti Жыл бұрын
If we pass an api key this way in the headers then that key value is showing in network call ...can you help how to hide that?
@DaveGrayTeachesCode Жыл бұрын
Right - this is just a quick way to not send it to GitHub and still deploy. You want this video: kzbin.info/www/bejne/q5ycoamfrtulqsk
@reverbmusic8444 Жыл бұрын
did you find a solution ?
@sportsstimulant42282 жыл бұрын
Can youse .env file ? And .gitignore file can put . nodemoduls and .env files recent time ?
@DaveGrayTeachesCode2 жыл бұрын
You can use a dot env file but you should never send it to Github. Always put the .env file in your .gitignore file. This tutorial shows how you can hide an API key from Github and still deploy to Netlify without using a .env file.
@ponce76004 жыл бұрын
thanks for the video, but at the end you say it's a good way to hide the api key, but, you're showing it! sorry, I don't understand, it's not hidden, anyone who sniffs the code will be able to find it.
@DaveGrayTeachesCode4 жыл бұрын
I said it is a good way to avoid putting a key in a GitHub repository and acknowledged there are other ways to hide the keys from your code entirely such as serverless or a backend relay. I plan to make videos on those methods as well. If you have a student project though, this method allows you to keep your key out of a GitHub repository and still use it for your project. Thanks for watching.
@thabangndlovu2 жыл бұрын
Thank you for the tutorial👍
@DaveGrayTeachesCode2 жыл бұрын
You're welcome!
@daniyalarif94873 жыл бұрын
Hi, the test.js file you created, wont that be on github anyways showing the keys?
@DaveGrayTeachesCode3 жыл бұрын
No, it will not go to Github. The apikey.js file is in the .gitignore file. That keeps it from going to Github. If you are referring to the file created on Netlify, it won't go to Github either. Netlify pulls files from the Github repo, but it does not send files to Github. I hope that helps to clarify 💯
@abigiyatadesse2672 Жыл бұрын
Thank you so much for the video.
@DaveGrayTeachesCode Жыл бұрын
You're welcome!
@RaniaAmina Жыл бұрын
Is there also possible to hide also from sources tab for plain html and vanilla js?
@DaveGrayTeachesCode Жыл бұрын
You would need to create an API key relay as I show here: kzbin.info/www/bejne/q5ycoamfrtulqsk
@RaniaAmina Жыл бұрын
@@DaveGrayTeachesCode thanks for answer. Will try on next project
@namucho266 Жыл бұрын
interesting video! thank you
@mozammel-being-mozammel Жыл бұрын
Now, what's the point of doing this? Anyone inspecting my source code from browser can now easily read and copy my api key and db configs....
@DaveGrayTeachesCode Жыл бұрын
If you use an API key in your frontend code at all, it can be seen through dev tools. As explained in the video, the point is not sending the key to GitHub. Especially for student projects. Want to keep it out of the frontend completely? Watch my video on setting up a relay: kzbin.info/www/bejne/q5ycoamfrtulqsk
@avshinkampf3 жыл бұрын
Nice work again, I tried the .dotenv way on my project, but this was easier!
@DaveGrayTeachesCode3 жыл бұрын
Glad it helped! 💯
@naolfekadu61012 жыл бұрын
this is not even hiding the api, the title is so misleading
@chinmaysonawane572 жыл бұрын
Thanks man this solved my problem
@DaveGrayTeachesCode2 жыл бұрын
Glad it helped!
@robertomaclean11409 ай бұрын
I hadn't idea Burton C. Bell is a programmer
@ecdu-eu2 жыл бұрын
Dear Dave, I hope you are well. Thank you very much for your effort and the video. It's really a big help. Maybe you have time-if it's not too much trouble-to answer two questions for me: I can get your project to run locally on my Ubuntu system without any problems. However, I have problems hosting the project on netlify. My questions about this would be: 1) How can I start the project with a file index.html so that .env remains hidden and (2) do you know a way how to activate the repository on netlify? netlify deploy works, but additional modules that were integrated via package.json do not work. The background to my question is that I would like to hide a larger number of required Amazon AWS SDK API's. Does it perhaps make sense to use react at this point? I would be grateful to you for an answer, since I've been desperate here for days. Many thanks and best regards, Stefan
@DaveGrayTeachesCode2 жыл бұрын
Javascript runs in the browser and anything used in the browser can be viewed. You can make it difficult to read with minification - that is minifying the JS files - but it will still be available to anyone that knows how to use devtools. You might consider putting the logic you want to hide in Node.js code that runs on the server. You can then set up a relay. I show how to do this here: kzbin.info/www/bejne/q5ycoamfrtulqsk
@Abberath2 жыл бұрын
@@DaveGrayTeachesCode I ran the build command but my netlify app still wont make the api call.
@ronaldodurandluna86176 ай бұрын
Thanks you !!
@Crunkmastaflexx3 жыл бұрын
thats a great trick! love it
@DaveGrayTeachesCode3 жыл бұрын
Glad I could help 💯
@TheVedantshah3 жыл бұрын
Hey i'm getting a Uncaught SyntaxError: Cannot use import statement outside a module error, what am I doing wrong?
@DaveGrayTeachesCode3 жыл бұрын
Sounds like your script tag needs type="module". At least that is the most common cause of that error.
@muhammadk232 жыл бұрын
so after researching for hours and i got to a place to secure my api key but after all this damn api is still visible? Ridiculous😂 thanks for the tutorial btw
@DaveGrayTeachesCode2 жыл бұрын
You're welcome - this works as a quick fix for student projects, but better solutions are here: kzbin.info/www/bejne/q5ycoamfrtulqsk and here: kzbin.info/www/bejne/gGi1fKtum5l5qNU
@minhduc98213 жыл бұрын
Hi, thank you for the video. How about smudging and cleaning data so whenever I checkout a branch the api key is updated?
@DaveGrayTeachesCode3 жыл бұрын
A different approach involving a little more upfront work, but this may be a good solution for development. I have not attempted it, so I am not sure how it would work with a Netlify deploy. I may have to try it out! Good question! Anyone wondering what we are discussing can look at this link for an overview: www.juandebravo.com/2017/12/02/git-filter-smudge-and-clean/
@fraternidadeaustriaca26252 жыл бұрын
Thanks a lot!
@DaveGrayTeachesCode2 жыл бұрын
You're welcome!
@my_vk_vlogs4 жыл бұрын
From git-hub we can hide api key this approach. but hackers can able to view our api key after deployment via source code. How we can hide our api key some one can't view our all kind of secret key.
@DaveGrayTeachesCode4 жыл бұрын
You are correct, and I mention this in the video. This also applied to the dot env approach. I will make other videos showing the approaches I mentioned: 1) a node js relay and 2) a serverless function. Thanks for asking.
@my_vk_vlogs4 жыл бұрын
@@DaveGrayTeachesCode thanks for your quick response
@webflyer035 Жыл бұрын
Someone trying to steal your api-key already knows where to look for it😂
@DaveGrayTeachesCode Жыл бұрын
If they want to specifically steal yours, but if want just want to keep it out of Github for a student project, personal project, etc. - this works. GitHub has bots crawling it for those keys.
@danielvega646 Жыл бұрын
does this still work?
@darshaanaghicha80234 жыл бұрын
I want this weather app tutorial... Where can I find it?
@darshaanaghicha80234 жыл бұрын
Where can I find a tutorial on this app??
@DaveGrayTeachesCode4 жыл бұрын
I need to make the tutorial. It is more complex than the average weather app, I am looking forward to making it when I can. Thanks for asking!
@darshaanaghicha80234 жыл бұрын
@@DaveGrayTeachesCode Sure I will be waiting for that. I am sure I will learn alot from it. I have learnt a lot from your videos. thanks sir
@DaveGrayTeachesCode4 жыл бұрын
@@darshaanaghicha8023 I am glad to hear it and happy to help. Thanks!
@lukasfritz6222 Жыл бұрын
Bad video because api key still gets shown in browser
@DaveGrayTeachesCode Жыл бұрын
I explained what this was for in the video. Search my channel for the API key relay. That is what you want.