Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

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

268.4K views
•
June 17, 2019
by
The Coding Train
YouTube video player
3.4 Hiding API Keys with Environment Variables (dotenv) and Pushing Code to GitHub

TL;DR

Learn how to hide API keys using environment variables and publish your code on GitHub.

Transcript

[DING] Hello, welcome to another Working With Data and APIs video. And in this video, I'm continuing the Weather Here Project, and I just wanted to one thing. One thing. A very important thing. I want to look at how to stop my API key from just sitting there in my code. I mean, I have something a little bit better here, which is at least the API ke... Read More

Key Insights

  • 🔐 Hiding API keys is crucial to prevent unauthorized access and maintain data security.
  • 💨 Environment variables offer a secure way to store sensitive information separately from the code.
  • 👨‍💻 The dotenv package simplifies the process of loading environment variables into code.
  • 📁 The .gitignore file helps exclude sensitive files from being shared on version control platforms like GitHub.
  • 🤩 Hiding API keys and publishing code on GitHub are essential steps in securing and sharing projects.
  • 📂 Additional precautions such as adding licensing information, a contributing file, and a code of conduct can enhance the openness and collaboration of an open-source project.
  • 👨‍💻 Running code off of GitHub is discussed briefly, with the suggestion of exploring it further in the future.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: Why is it important to hide API keys in code?

Hiding API keys prevents unauthorized access to sensitive information. If exposed, API keys can be abused to gain unauthorized access to resources or data.

Q: How can environment variables be used to hide API keys?

Environment variables allow you to store sensitive information separate from your code, making it more secure. By using packages like dotenv, you can easily load environment variables into your code.

Q: What is the purpose of the .gitignore file?

The .gitignore file specifies files or directories that should not be tracked or uploaded to a git repository. It is used to exclude sensitive or unnecessary files, such as dotenv files or node_modules, from being shared on platforms like GitHub.

Q: What is the recommended convention for storing environment variables?

It is recommended to store environment variables in a dotenv file or through a mechanism provided by the server you're using. The dotenv file convention is commonly followed, but it may vary depending on the platform or framework being used.

Summary & Key Takeaways

  • The video discusses the importance of hiding API keys in code and provides a solution using environment variables.

  • The dotenv package is introduced as a way to load environment variables from a dotenv file into the code.

  • The process of creating a dotenv file, storing the API key in it, and accessing it in the code is explained step-by-step.

  • The video also briefly covers how to create a .gitignore file to prevent sensitive files from being uploaded to a GitHub repository.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from The Coding Train 📚

I.0: Introduction - The Nature of Code thumbnail
I.0: Introduction - The Nature of Code
The Coding Train
13.7: Manual Parsing - Processing Tutorial thumbnail
13.7: Manual Parsing - Processing Tutorial
The Coding Train
Live Stream #153: Mastodon thumbnail
Live Stream #153: Mastodon
The Coding Train
How to Set Up Your Coding Environment with Node.js thumbnail
How to Set Up Your Coding Environment with Node.js
The Coding Train
8.6: Other Events and Inputs - p5.js Tutorial thumbnail
8.6: Other Events and Inputs - p5.js Tutorial
The Coding Train
8.6: API Front End Client - Programming with Text thumbnail
8.6: API Front End Client - Programming with Text
The Coding Train

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.