BUG: Universal Login default code issue

There is a issue with Universal Login default code so it works fine with default templates of auth0 login but when you switch to Universal Login the default code its not wokring

Hey there @shyga1

Can you share more context around it? Thank you!

I’ve fixed it thank you there was the url and I’m using openLDPA those needs to be changed

window.addEventListener(“load”, function() {
var config = JSON.parse(
decodeURIComponent(escape(window.atob(“@@config@@”)))
);

        var params = Object.assign(
          {
            /* additional configuration needed for use of custom domains*/
        		overrides: {
          		__tenant: config.auth0Tenant,
          		__token_issuer: 'https://xxx/'
        		}, 
            domain: config.auth0Domain,
            clientID: config.clientID,
            redirectUri: config.callbackURL,
            responseType: "code"
          },
          config.internalOptions
        );

        var webAuth = new auth0.WebAuth(params);

        var databaseConnection = "OpenLDAP";

        function login(e) {
          e.preventDefault();
          var username = document.getElementById("email").value;
          var password = document.getElementById("password").value;
          webAuth.login(
            {
              realm: databaseConnection,
              username: username,
              password: password
            },
            function(err) {
              if (err) displayError(err);
            }
          );
        }

        function signup() {
          var email = document.getElementById("email").value;
          var password = document.getElementById("password").value;

          webAuth.redirect.signupAndLogin(
            {
              connection: databaseConnection,
              email: email,
              password: password
            },
            function(err) {
              if (err) displayError(err);
            }
          );
        }

        function loginWithGoogle() {
          webAuth.authorize(
            {
              connection: "google-oauth2"
            },
            function(err) {
              if (err) displayError(err);
            }
          );
        }

        function displayError(err) {
          var errorMessage = document.getElementById("error-message");
          errorMessage.innerHTML = err.description;
          errorMessage.style.display = "block";
        }

        document.getElementById("btn-login").addEventListener("click", login);
        document
          .getElementById("btn-google")
          .addEventListener("click", loginWithGoogle);
        document.getElementById("btn-signup").addEventListener("click", signup);
      });
    </script>
1 Like

Perfect to hear that! Thanks for sharing it with the rest of community!

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