Oauth2
[not maintained] Allows your Martini application to support user login via an OAuth 2.0 backend.
Install / Use
/learn @martini-contrib/Oauth2README
oauth2 
Allows your Martini application to support user login via an OAuth 2.0 backend. Requires sessions middleware. Google, Facebook, LinkedIn and Github sign-in are currently supported. Once endpoints are provided, this middleware can work with any OAuth 2.0 backend.
Usage
See example_test.go for a sample.
If a route requires login, you can add oauth2.LoginRequired to the handler chain. If user is not logged, they will be automatically redirected to the login path.
m.Get("/login-required", oauth2.LoginRequired, func() ...)
Auth flow
/loginwill redirect user to the OAuth 2.0 provider's permissions dialog. If there is anextquery param provided, user is redirected to the next page afterwards.- If user agrees to connect, OAuth 2.0 provider will redirect to
/oauth2callbackto let your app to make the handshake. You need to register/oauth2callbackas a Redirect URL in your application settings. /logoutwill log the user out. If there is anextquery param provided, user is redirected to the next page afterwards.
You can customize the login, logout, oauth2callback and error paths:
oauth2.PathLogin = "/oauth2login"
oauth2.PathLogout = "/oauth2logout"
...
