Google Login with Custom Login Page is not working

I’m using custom template for login therefore I’m using auth0 CDN and using library’s built-in methods to work.

I’m able to login/signup with this there’s no problem but with google login when click on the button it redirect me to google login page for authentication. It redirect me back to auth0 then again redirect to my website but from my website it again redirect to auth0 login page. I’m not getting it where I’m doing wrong.

Note: I’m able to login with google when using default auth0 widget

<script src="https://cdn.auth0.com/js/auth0/9.16/auth0.min.js"></script>
<script>
      window.addEventListener("load", function () {
        var config = JSON.parse(
          decodeURIComponent(escape(window.atob("@@config@@")))
        );

        var leeway = config.internalOptions.leeway;
        if (leeway) {
          var convertedLeeway = parseInt(leeway);

          if (!isNaN(convertedLeeway)) {
            config.internalOptions.leeway = convertedLeeway;
          }
        }

        var params = Object.assign(
          {
            overrides: {
              __tenant: config.auth0Tenant,
              __token_issuer: config.authorizationServer.issuer,
            },
            domain: config.auth0Domain,
            clientID: config.clientID,
            redirectUri: config.callbackURL,
            responseType: "code",
          },
          config.internalOptions
        );

        var webAuth = new auth0.WebAuth(params);
        var databaseConnection = "Username-Password-Authentication";
        var captcha = webAuth.renderCaptcha(
          document.querySelector(".captcha-container")
        );

        function login(e) {
          e.preventDefault();

          webAuth.login(
            {
              realm: databaseConnection,
              username: username,
              password: password,
              captcha: captcha.getValue(),
            },
            function (err) {
              // console.log(err);
            }
          );
        }

        function signup(e) {
          e.preventDefault();

          webAuth.redirect.signupAndLogin(
            {
              connection: databaseConnection,
              email: email,
              password: password,
              captcha: captcha.getValue(),
            },
            function (err) {
              // console.log(err);
            }
          );
        }

        function loginWithGoogle() {
          webAuth.authorize(
            {
              connection: "google-oauth2",
            },
            function (err) {
              // console.log(err);
            }
          );
        }
    </script>