An alternative of oauth2_proxy implemented with njs scripting language. There is a similar implementation for NGINX Plus, but this can also work on open source NGINX.
- Edit
nginx/js/config.jsand fillclientIdandclientSecret- Create OAuth 2.0 Client ID here
- Add
http://localhost/oauth2/callbackto Authorized redirect URIs
- Run
docker-compose up -d - Open
http://localhost/ - Login with your gmail account
- It works!
- You must set
cookieSecreton production environment. - You can implement custom auth-strategy, see
nginx/js/handler.jsandnginx/js/acl.js. - You can pass some user profile to backend, see an end of
authHandlerfunction. - Initial implementation uses Google as an OpenID provider. Other providers also can be used.