Google Login API Won't Redirect After Signup

Hello Replit Community!

I’m attempting to test my Google API login functionality but I am unable to get it to redirect to my homepage after sign up. The API loads perfectly, the user is able to select their email and the Google login API popup successfully goes away. However, after signup it will not redirect to my homepage.

My project is not deployed yet. I’m using my development homepage URL. I included it in my Google Cloud Authorized redirect URIs.

My apologies in advance, I’m sure this is something really basic that I’m overlooking :person_facepalming:

Any help would be very much appreciated! Thank you!

<!DOCTYPE html>
    <title>Sign Up</title>
    <meta name="google-signin-client_id" content="">
    <script src="" async defer></script>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        .container {
            text-align: center;
    <div class="container">
        <h2>Sign Up with Google</h2>
        <div class="g-signin2" data-onsuccess="onSignIn"></div>
        <a href="#" onclick="signOut();" style="display:none;" id="signout">Sign out</a>

        function onSignIn(googleUser) {
            // ...

            // Redirect after successful sign-in
            window.location.href = 'my development homepage URL'; 

        function signOut() {
            var auth2 = gapi.auth2.getAuthInstance();
            auth2.signOut().then(function () {
                console.log('User signed out.');
                document.getElementById('signout').style.display = 'none';

        function startApp() {
            gapi.load('auth2', function(){
                    client_id: ''

        window.onload = startApp;

Hi @specificlook , welcome to the forums!

Could it be this bit that you need to change? To an actual route maybe?

This looks like the problem.

My homepage is included in my code, just left it out on this public post.

My client ID is included in my code, just left it out on this public post.

Is it in the JavaScript? If so, that’s a security risk. Anyone can get your client ID by inspecting your site.

It’s been turned into secret. The site is still private, it hasn’t been deployed yet which makes me feel as if there is a step I’m missing since it’s not deployed.

Really appreciate your help!

The sign up page loads as well as the google login popup, but when I select an authorized test email, spins as if it logins in, the popup page goes away but it does not redirect to my homepage, it stays on the /signup.html page.