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.js
and fillclientId
andclientSecret
- Create OAuth 2.0 Client ID here
- Add
http://localhost/oauth2/callback
to Authorized redirect URIs
- Run
docker-compose up -d
- Open
http://localhost/
- Login with your gmail account
- It works!
- You must set
cookieSecret
on production environment. - You can implement custom auth-strategy, see
nginx/js/handler.js
andnginx/js/acl.js
. - You can pass some user profile to backend, see an end of
authHandler
function. - Initial implementation uses Google as an OpenID provider. Other providers also can be used.