Skip to content

Instantly share code, notes, and snippets.

@hellobrian
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellobrian/a0a201d7ea0ff93a9518 to your computer and use it in GitHub Desktop.
Save hellobrian/a0a201d7ea0ff93a9518 to your computer and use it in GitHub Desktop.
How to store API Keys in node process?
// ./app.js
// My GitHub API credentials are all hardcoded in a credentials.js file
var credentials = require('./credentials');
var GITHUB_CLIENT_ID = credentials.github.id;
var GITHUB_CLIENT_SECRET = credentials.github.secret;
var CALLBACK_URL = credentials.github.callback;
// ./credentials.js
// This file is in .gitignore so we don't check in any these keys.
module.exports = {
github: {
id: 'GITHUB_ID',
secret: 'GITHUB_SECRET',
callback: 'http://127.0.0.1:3000/auth/github/callback'
}
// other API Keys here; truncated for length.
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment