Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
Auto relaod after login

I have a google login on my website, with an auto reload after the user is correctly logged in.

The problem is every time the user is browsing the website it is reloading the page.

So if he opens an article, it will load the page and the reload the page.

Here is my JS

    function onSuccess(googleUser) {
    var static_url = 'https://www.mywebsite.com/';
    
    gapi.client.load('oauth2', 'v2', function () {
        var request = gapi.client.oauth2.userinfo.get({
            'userId': 'me'
        });
        request.execute(function (resp) {
onclick="signOut();">Sign out</a></h3>';
</b>'+resp.id+'</p><p><b>Name: </b>'+resp.name+'</p><p><b>Email: </b>'+resp.email+'</p><p><b>Gender: </b>'+resp.gender+'</p><p><b>Locale: </b>'+resp.locale+'</p><p><b>Google Profile:</b> <a target="_blank" href="'+resp.link+'">click to view profile</a></p>';
            
            
            $.ajax({
                type: 'POST',
                url: static_url+'/deals/google_login',
                async: false,
                data: {email:resp.email,name:resp.name},
                success: function (result) {
                    $('.msg').removeClass('alert alert alert-danger');
                    $('.lmsg').show();
                    if(result == 'blocked'){
                        signOut();
                        $('.lmsg').addClass('alert alert-danger');
                        $('.lmsg').html('Your account is blocked');
                        setTimeout(function() {
                            $('.lmsg').fadeOut('slow');
                        }, 3000);
                    }else{
                        
                        if( window.localStorage ){
                        if( !localStorage.getItem('firstLoad') ){
                            $('.lmsg').addClass('alert');
                            $('.lmsg').html('Successfully Logged In');
                            localStorage['firstLoad'] = true;
                            $('.lmsg').fadeOut('slow');
                            window.location.reload();
                        }else
                            localStorage.removeItem('firstLoad');
                        }

                    }
                }
            });            
        });
    });
}

If I remove the window.location.reload(); the issue is gone, but user get stuck on the login page, so I really need to reload the page after the user logged in. To redirect it to the front page and load his profile picture, name...

Does any one already face this issue? or have a solution?

Thank you

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!