Skip to content

Repository files navigation

Auth0 JWT Proxy

This simple app implements several useful HTTP endpoints needed in the Oauth2/JWT authentication flow.

  • /login: will simply redirect to the appropriate Auth0 login page with all application-specific parameters (and save the Referer in a session cookie to redirect back to it after the completion of the authentication flow).
  • /callback: the most important endpoint, in charge of validating the token passed by Auth0 to the browser by HTTP redirect, against the Auth0 servers, to retrieve a JWT token and save it in a cookie under your domain. It also includes a basic UI to show your current login status, and the contents of your decoded JWT at /user.

It uses nodejs, passport, and the official Auth0 passport strategy.

To run and use

Just run the docker image with the right environment variables:

docker run auth0-docker -e NAME:VALUE -e NAME2:VALUE2 ...

It will serve the application at http://localhost:3000/.

The following variables may be used:

Variable nameRequired?PurposeExample
AUTH0_CLIENT_IDYesYour Auth0 Client ID, from your application settings in Auth0 portalypI8mltZkbAzb854T4RnzhjK8idFu2Y4
AUTH0_DOMAINYesYour Auth0 domainmydomain.eu.auth0.com
AUTH0_CLIENT_SECRETYesYour client secret, used to validate the JWT tokenc-aZ9-dAmNzjT7c0D7yfxwZ4vo8n2e2te9_qEF5yX-XoSHjRcY64DgWLbPF8dkq3
RETURN_URLNoThe default URL to redirect back to after login, defaults to '/'/
SESSION_SECRETNoA random key used to encrypt the session cookie used to remember the original Refererwd#R%g45g
URL_CONTEXTNoA base URL under which to serve all the endpoints. Useful for reverse proxy setup. Defaults to root '/'/auth
COOKIE_NAMENoThe name of the cookie to be used to save the JWT

The server is intended to be run behind a proxy in order to be served inder the same domain as your application so it can share the cookie.

About

Docker image to implement Auth0 callback API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages