steven-king / mj487

Class Resources and management for Intermedia Interactive media
1 stars 3 forks source link

How to protect API keys from Github #17

Open steven-king opened 6 years ago

steven-king commented 6 years ago

The basic idea is to:

  1. Store the creds as a var in a separate js file.
  2. Call that js file into your html prior to your script that uses it.
  3. Call the Var with the key in your request.
  4. Create a git ignore file to not include the new js file.

Here is a step-by-step guide I will demo in class. https://gist.github.com/derzorngottes/3b57edc1f996dddcab25