Тёмный

3.4 Hiding API Keys with Environment Variables (dotenv) and Pushing Code to GitHub 

The Coding Train
Подписаться 1,7 млн
Просмотров 272 тыс.
50% 1

In this lesson, we will address how to can hide an API key using environment variables and open source the code on GitHub.
💻github.com/CodingTrain/Intro-...
🔗 dotenv: www.npmjs.com/package/dotenv
🔗 GitHub: github.com/
🎥 NEXT LESSON: • 3.5 Web Application De...
🎥 PREVIOUS LESSON: • 3.3 Mapping Database E...
🎥 FULL COURSE: • Working with Data and ...
🎥 Git and GitHub: • 1.1: Introduction - Gi...
🚂 Website: thecodingtrain.com/
💖 Patreon: / codingtrain
🛒 Store: www.designbyhumans.com/shop/c...
📚 Books: www.amazon.com/shop/thecoding...
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...

Опубликовано:

 

16 июн 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 222   
@Warpgatez
@Warpgatez 2 года назад
After years, I still come back to your videos. Doesn't matter which one. I just come back to them. They solve so many issues. When I first discovered you I wasn't working with JS at all. But enjoyed watching your videos. Now I am working with JS. So I am back
@honeybcomb
@honeybcomb 4 года назад
I randomly came across this video and I can't go without thank you ! Your explanations are very clear and makes the course material simple to understand. Thank you very much ! I am so happy I fond your channel today :))
@hj1916
@hj1916 Год назад
It was never boring! Actually, you made this serious topic so fun like magic. Also, I loved the ending credit of the train. Creative idea!!! Thank you so much!!!!
@SaiKumar-vf9lz
@SaiKumar-vf9lz 4 года назад
From hiding api keys to adding local source to GitHub ..well summarized things in 10 mins ..great video !
@gme0ver24
@gme0ver24 5 лет назад
Useful stuff as always. Waiting for the next video!
@aakash-codes
@aakash-codes Год назад
I just love the way you teach things! Doesn't even let me feel boring for a single sec! 😊🚀
@Rlc201
@Rlc201 4 года назад
How i didn't know this channel? Awesome tutorial and one of the best teachers that i have ever seen on youtube. Keep up!
@aristotleanderson930
@aristotleanderson930 4 года назад
This is a great tutorial! Thank you for being quick and to the point, as well as informative and helpful!
@gustavotomas5214
@gustavotomas5214 2 года назад
You probably dont give a damn but does someone know a way to log back into an instagram account? I somehow forgot my account password. I love any help you can give me.
@casenace5722
@casenace5722 2 года назад
@Gustavo Tomas Instablaster :)
@gustavotomas5214
@gustavotomas5214 2 года назад
@Casen Ace thanks so much for your reply. I found the site thru google and Im waiting for the hacking stuff now. Seems to take a while so I will reply here later when my account password hopefully is recovered.
@gustavotomas5214
@gustavotomas5214 2 года назад
@Casen Ace It did the trick and I finally got access to my account again. I am so happy! Thank you so much, you really help me out!
@casenace5722
@casenace5722 2 года назад
@Gustavo Tomas no problem =)
@MrGreg557
@MrGreg557 2 года назад
What a great series man, I'm grateful everyone can use resources like this. Going from knowing almost 0 JS to deploying my app was very satisfying. One update though: if you get this error like me: "npm ERR! Missing script: "start"", add this to the end of your package.json file, before the finishing curly brace: ,"scripts": { "start": "node index.js" },
@leerenae313
@leerenae313 3 года назад
Hey, love your videos! they're so straight to the point Thank you for putting this out for free 🙏
@benSfft
@benSfft 4 года назад
Thanks a lot ! That's clear and the objectives are so well explained ! I didn't even know that we could code on ecstasy !
@moaazbhnas886
@moaazbhnas886 4 года назад
I was searching for a video about env file and felt relief when I saw yours
@snehagangurde6266
@snehagangurde6266 4 года назад
Thank you so much i have been searching one good video for days. finally got this one. this one is quick, understandable
@SnobbyLion
@SnobbyLion 8 месяцев назад
You're so good at explaining things! Thank you!
@janetrajkoski1424
@janetrajkoski1424 3 года назад
As someone who just started learning to code and my first interview being: "The hell you doing your API key is public", this was a godsend video. Very to the point and clear explanation. Subscribed
@simonmafanye.3537
@simonmafanye.3537 Год назад
Watched your video for 5minutes and i have no choose but to hit the Subscribe button very fast. I love your style of teaching,
@zeyadahmedsamer3443
@zeyadahmedsamer3443 2 года назад
no words can describe your awesome explanation
@bandarabdullah40
@bandarabdullah40 4 года назад
I was suffering to understand the environment variable and its benefits this video the best explanation I have ever seen.
@dennisgonzales9521
@dennisgonzales9521 3 года назад
Very engaging! thank you for the lesson.
@drhastings
@drhastings 3 года назад
Simple and straight to the point thank you👏🏿
@sweickel
@sweickel 3 года назад
Thank you! This is exactly the video and explanation I needed!
@kingsley3194
@kingsley3194 2 года назад
Thank you so much. You saved my day with this explanation
@zensic
@zensic Год назад
Thank you! Was just looking for this
@skrillex15
@skrillex15 2 года назад
Thanks for this playlist. Really helped
@zwlw
@zwlw 2 года назад
you're a legend dude this is a life saver
@familyjuega12345
@familyjuega12345 2 года назад
Awesome content and explanation, thanks man!
@oyetorostephen5010
@oyetorostephen5010 4 года назад
THank you! I find this fun to learn
@arshamazami159
@arshamazami159 3 года назад
The best video about environment variable and how to use them👍👍👍
@bluemagicuk
@bluemagicuk 4 года назад
super helpful - thank you!
@lorisp186
@lorisp186 Год назад
Thank you man, I was exactly looking for that
@edwincaceresi.3284
@edwincaceresi.3284 3 года назад
Thanks! It was very clear!
@pjguitar15
@pjguitar15 3 года назад
You're a great teacher!!!
@nicholashendrata
@nicholashendrata 3 года назад
THIS SAVED MY LIFE THANK YOU
@bacanalienigena
@bacanalienigena Год назад
It works amazingly, thanks a million!
@ivankljun2542
@ivankljun2542 3 года назад
Very nice, thank you, very educational and entertaining! :)
@DieHard88913
@DieHard88913 4 года назад
Thank you! this helped me a lot, earned a new sub :D
@appiahseth5319
@appiahseth5319 3 года назад
Great presentation. Thank you very much
@davidchopin6583
@davidchopin6583 3 года назад
So, so useful. Thanks!
@220syedrazamehdirizvi7
@220syedrazamehdirizvi7 Месяц назад
U made it so fun to watch ....❤
@LimitlessGamingYoutubeChannel
@LimitlessGamingYoutubeChannel 3 года назад
Super helpful video!
@abigiyatadesse2672
@abigiyatadesse2672 2 года назад
Thanks so much this is helpful.
@nicetomeetugaming7024
@nicetomeetugaming7024 2 года назад
Amazing video sir!
@sharadsharma3176
@sharadsharma3176 5 лет назад
eagerly waiting for the next video of this series.... I want to know more about the available hosting services for node.
@noco2605
@noco2605 2 года назад
Thank you very much for your explanation 😊
@hargur4121
@hargur4121 2 года назад
Thanks a lot! This has been a lifesaver
@techmarinar
@techmarinar 3 года назад
thanx man , this was helpful
@tegaogheneovo5881
@tegaogheneovo5881 3 года назад
So keep working on my project and when I want to deploy hide all my keys and db names thank you 😁
@mohammedraqeeb4392
@mohammedraqeeb4392 2 года назад
Great explanation
@smashing_data4292
@smashing_data4292 5 месяцев назад
As someone who has done this before on my own projects I can say this is legit. Immediate subscribe.
@santiagootero3580
@santiagootero3580 3 месяца назад
you are the goat, thanks so much
@serdarinjo
@serdarinjo 2 года назад
Muchas gracias bro 😀!
@gideonaswani2449
@gideonaswani2449 2 года назад
Awesome, thanks
@nicetomeetugaming7024
@nicetomeetugaming7024 2 года назад
BTW you are amazing teacher!
@sazaam
@sazaam 3 года назад
Simply awesome
@Vincetroid
@Vincetroid 3 года назад
You saved me, suscribed!
@RayfranRocha
@RayfranRocha 4 года назад
Spectacular tutorial! Thank you. It's very clear. I wonder if using any browser inspector, can anyone see the API_KEY? Looking inside the code or in the Request to the API message?
@m_ko
@m_ko 5 лет назад
So nice thanks for this video
@ousmaneyadely
@ousmaneyadely 4 года назад
Thanks a lot! I was totally stuck with a bug until I watched your video. So clarifying!
@danieloliveira9815
@danieloliveira9815 3 года назад
Typing those command line commands made me feel like a real programmer 😎 Thank you for this awesome playlist!
@dreznik
@dreznik 4 года назад
sheefmahn brilliant series of videos. any videos where you interact with a Database-as-a-Service? SQL or not
@MuhammadRizky-ub3oy
@MuhammadRizky-ub3oy Год назад
i love your energy
@onmroman5391
@onmroman5391 3 года назад
You helped me
@Niehde
@Niehde 5 лет назад
Nice video! I've just recently pushed some API keys to Github. Fortunately they have a service that lets you know when you've screwed up.
@amjedbouhouch7993
@amjedbouhouch7993 4 года назад
Same 🤣🤣
@Cam-lm6wo
@Cam-lm6wo 3 года назад
incredible video, I spend like 1 year in a College trying to use GitHub as they told me without actually know what I was doing. thank you! Just a question... Can I add to the .env file a private key from firebase?
@willuk7336
@willuk7336 3 года назад
Thanks dad xx
@instinqueue4689
@instinqueue4689 2 года назад
Thanks 👍
@jamjam3448
@jamjam3448 3 года назад
Thanks a lot
@kenfeier5542
@kenfeier5542 7 месяцев назад
Great tutorial, but I do want to mention one thing. Environmental variables help you hide your sensitive information for version control purposes. If you build a public website and have environmental variables showing on client side, a user can open the debugger and hover over those variables and see the values of them. Make sure that you use these variables on back-end (server) side if you don't want anyone to see their values.
@patrickporter6441
@patrickporter6441 3 года назад
I had a question: Can the same effect be accomplished with a config.json and including that in the gitignore?
@sametpalitci1273
@sametpalitci1273 3 года назад
thank you
@kritikshivanshu
@kritikshivanshu 4 года назад
@TheCodingTrain Hi there! I am facing problem in order to upload .env file in my github repo. Since the application doesn't fetching information. What to do???Please help me.
@Jb67912
@Jb67912 4 года назад
you don't need an access token for the logs js file? It seems the website of mapbox requires one
@nofacee94
@nofacee94 5 лет назад
If your file is called index.js, you can just do `node .` or `node index`
@adedimolao9094
@adedimolao9094 4 года назад
can you use .env and gitignore in a vanilla js project?
@ggaa16990
@ggaa16990 3 месяца назад
Bigg thankkk sir
@shravans7184
@shravans7184 2 месяца назад
Thanks
@aham3687
@aham3687 5 лет назад
could continue this series with PWA. This has been popular with web technology in this modern day.
@lochsandro
@lochsandro 3 года назад
Nice video!!! How to use this environment variables in the CI(actions)?
@zorro1rr
@zorro1rr 4 года назад
I'm getting the api key returned in my terminal, but now my data is not being returned in the browser and getting console error: Uncaught ReferenceError: require is not defined. Help please
@TheCodingTrain
@TheCodingTrain 4 года назад
Our Coding Train Discord is a great place to get help with coding questions ! discord.gg/hPuGy2g - The Coding Train Team
@nighknight9012
@nighknight9012 3 года назад
if you are working on linux you may experience a problem when running the code, "undefined" gets returned, thats because you need to set the env variable yourself. go to bashrc and do export ENV_VARIABLE=VALUE no spaces around the equal and if the VALUE has spaces add quotes around it
@unscripted483
@unscripted483 3 года назад
so if someone down loads the repository to try out the web app will they still be able to use is even though they wont have the api key... (for me i didn't want to show the world my database URL and password)
@GopalChand
@GopalChand 10 месяцев назад
Hi, how about if i am using Docker and dont want to publish my .env file in git. But my application is require env file. Can you pls help how to use .env file in Docker container or K8
@Viralplace
@Viralplace 3 года назад
but this works just for development on github... if I go in production like a jam stack project? it is not hidden right?
@xtree2817
@xtree2817 2 года назад
I exactly landed where i wanted to be. I was just looking for this
@bhavsar9904
@bhavsar9904 3 года назад
Hello I am using Angular latest version with nodejs and I am new to it. In Angular we have environment.ts file where we keep API key details. I have used dotenv and generating environment.ts with with node script using dotenv. Now when we build and serve angular application and go to browser and do page view source. Enviornment.ts file is viewable in main.js file with all the details and that I dont want to expose. Any suggestion how to stop exposing this file data in page view source?
@piyushtale0001
@piyushtale0001 3 года назад
Great Great Great
@akramsyed3628
@akramsyed3628 2 года назад
i am first here and very impresed they way you teach , ke
@notprivy
@notprivy 3 года назад
I see that we can do without require by using node -r. Can you explain how to do it?
@Felipecuevas
@Felipecuevas 4 года назад
it only work with node servers but if I try to do it with angular have some several problems
@santra528
@santra528 3 года назад
Using dotenv package and store the API_KEY in .env file does not completely hide the API_KEY. It is fine for GitHub because someone visiting this repo they wont be able to see the API_KEY. But if the project is deployed in sever then anyone can see the API_KEY from the browser when they visit this particular website. The best way to hide the API_KEY is store it in the backend and make the API calls from the backend only. Only send the response data to the frontend. And to add more security you can set up CORS for the API_KEY so even if someone gets access to the API_KEY they wont be able to send request as the request will be rejected and only the request from the domains mention in the CORS will be able to make successful request using this API_KEY.
@incandescentbruh
@incandescentbruh 3 года назад
No one is dumb enough to put the api key in frontend, also the example code in the video is using express js which is run by node js in backend.
@cperez7785
@cperez7785 3 года назад
Does anyone know how to find your API key? The text folder I created I accidentally deleted and I had to re-generate new APY keys but I do not know where I may find this text file to update it. Any help will appreciate it!
@cosmos9227
@cosmos9227 3 года назад
Sir where I can Find import and export folder maker in android app resource?
@gokulkannan1348
@gokulkannan1348 4 года назад
can xhr requests be hidden from the console?
@akhilyadav7426
@akhilyadav7426 5 лет назад
Please publish the continued episode fastly sir waiting for it A subscriber from INDIA #Codingtrain
@ilearncode7365
@ilearncode7365 2 года назад
From a “security/ privacy” standpoint, how is this any better than just having a js file with a variable for thr api key in it?
@JanacMeena
@JanacMeena 2 года назад
2:00 start 5:30 Create a sample .env Make sure .gitignore has .env listed
@jonathan-._.-
@jonathan-._.- 5 лет назад
:( iwanna follow the CodingTrain git organization but there is no button
@buzzfeedRED
@buzzfeedRED 4 года назад
awesome : - )
@iNVICTUX
@iNVICTUX 5 лет назад
good video
@lynx7077
@lynx7077 3 месяца назад
Great Tutorial! Although i have a question and i hope some good soul will answer me. During my Bootcamp, we never got tought or warned to hide our API Keys. So now that i am about to apply for jobs, i have been overwhelmed with the fact that i need to hide my personal API key that i used for my projects (it's a free personal key from my bootcamp). So my question is: What should i do that i already committed and publicly pushed all of my projects and API keys on my github? Thankfully no one has access to it yet but i need to take action before sending applications or post my github to Linkedin. Any advice would be greatly appreciated 🙏🙏
Далее
Throbber #genuary7
0:53
Просмотров 40 тыс.
#genuary15 physics library!
0:40
Просмотров 188 тыс.
Genuary After Dark
0:58
Просмотров 12 тыс.
JavaScript Pro Tips - Code This, NOT That
12:37
Просмотров 2,5 млн
5 JavaScript API Key Mistakes (and how to fix them)
12:49