Search code examples
pythonangularoauth-2.0gmail

Storing API credentials files on GitHub


I'm working on a Python Angular app that integrates Gmail API. I have 3 JSON files for token, credentials, and a specific file which I need to authenticate the Gmail API so my app can generate emails to send to email addresses via OAuth2. I got my app to work using the credentials. I've been wondering about this question.

Is there a way to store those files without committing them to GitHub? I want to host this app on the Heroku platform but I don't want to compromise that by including those JSON files which contain the secret client key, ids, etc.


Solution

  • Environment variables. Here's a Heroku guide: https://devcenter.heroku.com/articles/config-vars

    How to use them locally, depends on your OS and/or shell you're using. It can be a .bashrc file (or .zshrc or another one like that) in your home directory, it could be something clickable in Windows.