Auth0 with ClojureScript

Jeff Terrell created an amazing ClojureScript + Auth0 integration, and I wanted to share it with everyone in the community.

This is a ClojureScript port of our JavaScript Spa sample (auth0-javascript-samples/01-Login at master · auth0-samples/auth0-javascript-samples · GitHub)

The code and README can be found at Jeff Terrell / Auth0 example in Clojurescript and re-frame · GitLab while a deployed site can be found at https://auth0-cljs-re-frame.jeffterrell.tech/

This ClojureScript Spa is designed for simplicity while still maintaining real functionality. It offers more robust error handling and automatic login redirection when going to the /profile path, which will correctly go back to /profile after logging in rather than the root path.

Further features include:

  • Authentication implementation contained in a single namespace, with a minimal interface to access Auth0 functionality.
  • Protected pages automatically redirect to login page, then back to that page after successful authentication.
  • Refresh works on any page.
  • User profile data is fetched and displayed, including the Gravatar for the email address.
  • Auth errors are caught and displayed. (Try blocking the /token URL in the browser dev tools.)

I hope other members of the community find this useful, and big thank you to Jeff for creating this!

Thanks for sharing it with the rest of community David!