Add login with OAUTH to your Goji webapp.
Currently supports github, but additional OAUTH providers can be plugged in.
I'm using this with http://apinalytics.tanktop.tv and http://betterrecommendations.com. In the Better Recommendations case I've created a Shopify OAUTH plugin.
See the example code in /example for full details, but the basics are as follows.
- Create a SessionHolder from https://github.com/philpearl/tt_goji_middleware/base, and add session middleware to your mux.
- Call tt_goji_oauth.Build() and add the handler it returns to your mux. We suggest you add it at /login/oauth.
- Add pages that have logged-in users to your mux beneath the session middleware.
- To login, POST to /login/oauth/start/github/. Add a 'next' parameter to control where the user is redirected to after login
- When login completes the callback you registered calling tt_goji_oauth.Build() will be called with user information. You should check the user against your database at this point, and set up information in the session.
- The user will be redirected to /, or where-ever you specified via the next parameter.