I wrapped up my work on OldPosts by creating a CloudWatch event to trigger my Lambda job every day. This will automatically add old posts to buffer if any exist. CloudWatch is useful for many things, but in this particular case it is being used as Cron As A Service.

Next I fell down a huge rabbit hole trying to get started with Auth0 in a Flask application. The documentation is okay, but I have bought into using the factory pattern in Flask, and it got a little messy.

Working with the factory pattern can be kind of a mind f**k because it seems like if you put the config in once place you pay for it in another. I ended up going with this approach.

  1. Add the oauth remote app to the factory
         with app.app_context():
             auth0 = oauth.remote_app(
                     'scope': 'openid profile',
                     'audience': 'https://{0}/userinfo'.format(app.config['AUTH0_DOMAIN'])
  2. In a separate module, when calling auth0 I grab the object instead of the variable.
     resp = oauth.remote_apps['auth0'].authorized_response()
It’s still not clear to me how to make auth0 “global” using the factory pattern but this approach does work.

Overall once I got auth0 to work I was super impressed with the product. Every time I start a new project I spend a week re-inveting the wheel with auth and forget what the project was even about. This time I only spent an evening implementing Auth0 and now I can move on to the actual meat of the code.