0

With regards to Auth0, I tried (and failed) to get a working registration / login flow. So I have a few questions to make sure I have a good understanding of the library.

I've correctled configure an allowed callback url in the auth0 dashboard. And I can i) instantiate Lock, ii) show the pop-up and iii) make a call out to Auth0. But ...

  • When first calling out to Auth0, I can't seem to send along a custom redirect_uri. Lock always sends the current page, not the custom redirect_uri (http://localhost/authenticated) that I set it to.

  (def lock (js/Auth0Lock. “user-key” “user.auth0.com"
                           #js {:auth {:redirect false
                                  :redirectUrl "http://localhost:8000/authenticated"}}))

  (.show lock)

  • It always reloads the current page (callback URL). And I can't find a way to instead make an Xhr call. Can we do Xhr on logins and registrations ? I can only find functions and docs that hit a callback URL.
  • I'm also curious to know if I separately need to pull in Auth0.js, or if Lock just does that implicitly (i.e., can Auth0.js do the same UI pop-up as Lock).

This guy seemed to be trying something similar. But even he opted for another approach.

Community
  • 1
  • 1
Nutritioustim
  • 2,686
  • 4
  • 32
  • 57

1 Answers1

1

As for your redirect not working, remove the redirect: false in the options (by putting redirect: false you are explicitly telling Lock not to redirect and instead stay on the same page (by using popup mode).

If you need to make Javascript calls to the authentication API, you can add valid origin URLs to the Allowed Origins (CORS) field in the definition of a client/app. URLs added as Callback URLs are automatically added.

As for Auth0.js, a client was available directly from Lock in v9 by using lock.getClient(). In v10, Lock doesn't return a client anymore, you will need to create your own Auth0.js instance. See https://auth0.com/docs/libraries/lock/v10/auth0js for more details.

Nico Sabena
  • 6,764
  • 1
  • 14
  • 11