Blog 


Aug 16, 2014 - 1 MIN READ

HOW TO: authorize google oauth credentials through a Heroku environment
Step-by-step guide to use Google APIs with OAuth credentials on Heroku without re-authentication. Python, OAuth2, refresh tokens, and environment variables.

Ryan Prater
- Take a look at heroku-config and install it.
- Create a file called ".env" in your project root directory and fill it with your environment variables. Make sure there's no spaces between your assignments.
Example - Make sure everything is running smooth with
$ foreman start
- Implement the
read_env()
function shown here - Create an instance of OAuth2WebServerFlow with access_type="offline" and approval_prompt='force'. This will grant you a refresh token and relieve you of having to re-auth every time your application runs.
- Run your application with typical OAuth storage shown here and copy your stored credentials into your CREDENTIALS variable in your .env file.
- Load your credentials like so:
json.loads(os.environ.get('CREDENTIALS'))
- Construct an OAuth2Credentials instance
- Now your refresh token should prevent you from having to authorize and your credentials should be valid. You can now authorize and make API requests.

My thoughts on a Web Applications class
Curriculum design thoughts for UT Austin web applications class. Teaching modern web development, databases, infrastructure, security, and practical skills for students.
HOW TO: change disc brake pads on an old Honda motorcycle
DIY motorcycle brake pad replacement guide. Fix squealing disc brakes on Honda motorcycles with step-by-step instructions, tools needed, and safety tips.