Disable sign up for mobile app

Hi, I have two applications: web and mobile, is it possible to hide sign up for mobile app only?

Hi @ihor.dmitriiev,

Welcome to the Auth0 Community!

Yes, it is possible. When using the Classic Universal Login experience, there is the option to conditionally render the Lock widget for different applications (client_id).

To do so, you will need to go to your Auth0 Dashboard > Branding > Universal Login > Login Page and include a condition in your custom login page script to disable the signup option for your mobile app. Moreover, you will need to set the allowSignUp property to false. Once that is done, your mobile app will have no option for the users to sign up.

Here is a code snippet you can use and replace with your client_id of your mobile app.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>Sign In with Auth0</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
</head>
<body>

  <!--[if IE 8]>
  <script src="//cdnjs.cloudflare.com/ajax/libs/ie8/0.2.5/ie8.js"></script>
  <![endif]-->

  <!--[if lte IE 9]>
  <script src="https://cdn.auth0.com/js/base64.js"></script>
  <script src="https://cdn.auth0.com/js/es5-shim.min.js"></script>
  <![endif]-->

  <script src="https://cdn.auth0.com/js/lock/11.32/lock.min.js"></script>
  <script>
    // Decode utf8 characters properly
    var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@'))));
    config.extraParams = config.extraParams || {};
    var connection = config.connection;
    var prompt = config.prompt;
    var languageDictionary;
    var language;

    if (config.dict && config.dict.signin && config.dict.signin.title) {
      languageDictionary = { title: config.dict.signin.title };
    } else if (typeof config.dict === 'string') {
      language = config.dict;
    }
    var loginHint = config.extraParams.login_hint;
    var colors = config.colors || {};

    // Available Lock configuration options: https://auth0.com/docs/libraries/lock/v11/configuration
    if (config.clientID === "YOUR_MOBILE_APP_CLIENT_ID") {
    var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
        auth: {
          redirectUrl: config.callbackURL,
          responseType: (config.internalOptions || {}).response_type ||
          (config.callbackOnLocationHash ? 'token' : 'code'),
          params: config.internalOptions
        },
        allowSignUp: false,
        /* additional configuration needed for custom domains
            configurationBaseUrl: config.clientConfigurationBaseUrl,
            overrides: {
              __tenant: config.auth0Tenant,
              __token_issuer: 'YOUR_CUSTOM_DOMAIN'
            }, */
        assetsUrl:  config.assetsUrl,
        allowedConnections: connection ? [connection] : null,
        rememberLastLogin: !prompt,
        language: language,
        languageDictionary: languageDictionary,
        theme: {
          //logo:            'YOUR LOGO HERE',
          primaryColor:    colors.primary ? colors.primary : 'green'
        },
        prefill: loginHint ? { email: loginHint, username: loginHint } : null,
        closable: false,
        defaultADUsernameFromEmailPrefix: false
      });

      if(colors.page_background) {
        var css = '.auth0-lock.auth0-lock .auth0-lock-overlay { background: ' +
            colors.page_background +
            ' }';
        var style = document.createElement('style');

        style.appendChild(document.createTextNode(css));

        document.body.appendChild(style);
      }

      lock.show();
    }
	
	//This line controls Lock for all other apps
	else {
      var colors = config.colors || {};

      // Available Lock configuration options: https://auth0.com/docs/libraries/lock/v11/configuration
      var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
        auth: {
          redirectUrl: config.callbackURL,
          responseType: (config.internalOptions || {}).response_type ||
          (config.callbackOnLocationHash ? 'token' : 'code'),
          params: config.internalOptions
        },
        /* additional configuration needed for custom domains
            configurationBaseUrl: config.clientConfigurationBaseUrl,
            overrides: {
              __tenant: config.auth0Tenant,
              __token_issuer: 'YOUR_CUSTOM_DOMAIN'
            }, */
        assetsUrl:  config.assetsUrl,
        allowedConnections: connection ? [connection] : null,
        rememberLastLogin: !prompt,
        language: language,
        languageDictionary: languageDictionary,
        theme: {
          //logo:            'YOUR LOGO HERE',
          primaryColor:    colors.primary ? colors.primary : 'green'
        },
        prefill: loginHint ? { email: loginHint, username: loginHint } : null,
        closable: false,
        defaultADUsernameFromEmailPrefix: false
      });

      if(colors.page_background) {
        var css = '.auth0-lock.auth0-lock .auth0-lock-overlay { background: ' +
            colors.page_background +
            ' }';
        var style = document.createElement('style');

        style.appendChild(document.createTextNode(css));

        document.body.appendChild(style);
      }

      lock.show();
    };
  </script>
</body>
</html>

Please let me know if there’s anything else I can do to help.

Thank you.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.