Search code examples
ionic2auth0

Auth0 lock not showing sign up option


I'm using the Auth0 lock in my Ionic 2 mobile application. I've recently updated to the latest Auth0(7.0.3) and Auth0-lock(10.0.0) versions. Now I've noticed that the options for the lock have changed, primarily the names of those options. Here the API for Auth0-lock(10.0.0) => https://auth0.com/docs/libraries/lock/v10/customization#allowsignup-boolean-
Previously there were the following options:

var options = {
    disableSignupAction: false,
    signupLink: myUrl
}

Those should now be

var options = {
    allowSignUp: true,
    signUpLink: myUrl
}

These options are passed into the constructor of Auth0Lock:

lock = new Auth0Lock(auth0ClientID, auth0Domain, options);

I'm certain most of my other options are applied to the lock as the closable: false option I have included in options applies to the lock resulting in the removal of the close button.

I have tried some variations in capital letters of allowSignUp and signUpLink as the old api used a different property name for the sign up link -> signupLink, however none of the combinations seem to work.

How can I enable the sign up action for the Auth0 lock?


Solution

  • These options are correct for Lock v10:

    var options = {
      allowSignUp: true,
      signUpLink: myUrl
    }
    

    allowSignup has a default value of true, and providing a value to signUpLink will also force allowSignUp to true.

    However, keep in mind that the signup option will only appear if your client (app) has a database connection enabled. Also, if the database connection has sign ups disabled or you are using a custom database which doesn't have a create script, then the sign up screen won't be available.

    Additionally you can find what changed and a migration guide at https://auth0.com/docs/libraries/lock/v10/migration-guide