Your address will show here +12 34 56 78

Home Forums WP ESTATE – Real Estate WordPress Theme FORUM Google Login not working

This topic contains 11 replies, has 4 voices, and was last updated by  Fiz 1 year, 4 months ago.

  • Author
    Posts
  • #100945

    mi000001
    Participant

    hello Anna,

    We did all the steps with google login, api etc etc.

    when we click google login, it give the consent screen and we click accept, the landing URI http://www.domain.com/my-profile does not appear…

    instead, it goes to http://www.domain.com

    as if you went straigght to the home page…

    any update?

  • #100950

    mi000001
    Participant

    NOTE: this is also not working on the DEMO at http://www.wpresidence.net

    Tried loggin in there with facebook, OK, with yahoo, OK but with google, NOT OK

    It redirects to the main site without any logged in menus goes back to http://www.wpresidence.net and NOT http://www.wpresidence.net/my-profile like it does with facebook and yahoo.

    Please check it out for us.

    Thank you

    • #100951

      mi000001
      Participant

      Also, we discovered this… everytime we try to login with google (while it is not working still) a new agent gets created… see below:

      569
      (no title)
      0 1 min ago
      Published No
      Select (no title)
      568
      (no title)
      0 1 min ago
      Published No
      Select (no title)
      567
      (no title)
      0 4 mins ago
      Published No
      Select (no title)
      566
      (no title)
      0 8 mins ago
      Published No
      Select (no title)
      565
      (no title)
      Edit | Quick Edit | Trash | View | Edit with Visual Composer
      0 27 mins ago
      Published No
      Select (no title)
      564
      (no title)
      0 27 mins ago
      Published No
      Select (no title)
      563
      (no title)
      0 28 mins ago
      Published No
      Select (no title)
      562
      (no title)
      0 1 hour ago
      Published No
      Select mi.is
      561
      mi.is
      0 1 hour ago
      Published No
      Select (no title)
      560
      (no title)
      0 9 hours ago
      Published No
      Select (no title)
      559
      (no title)
      0 9 hours ago
      Published No

  • #100982

    Anna
    Keymaster

    Hi,

    I have checked http://wpresidence.net/, and it takes me on the http://wpresidence.net/my-profile/, not the homepage.

    Please open a ticket in our ticket system http://support.wpestate.org/ and provide link, wp-admin credentials and Google credentials, so we can check the settings of your account.

    Thank you,
    Anna

  • #100989

    mi000001
    Participant

    Hi Anna,

    we tried again, from several diffrent computer / diffrent locations etc. even diffrent countries wpresidence.net and the google button reroutes back to the main page with any loggen in menus.

    Maybe your cache is not cleared, maybe there is a new issue with google’s process…

    I am not sure, but aside from our own site, your demo site has the same issue we are having from completly new location and unrelated web browerser to our website.

    maybe it is worth a second look. please let us know.

    thank you

  • #100994

    DeepDreams888
    Participant

    Hi,

    I am having the same issue. as mentioned by mi000001, I also tried to login via google in the wpestatetheme.org and wpresidence.net and it just redirect me to the homepage.
    furthermore, I manually typed-in the profile page (wpestatetheme.org/my-profile and wpresidence.net/my-profile) it redirected me to the homepage as well.

    Please notify us if you have solved the issue. thanks

    • #101061

      mi000001
      Participant

      BUMP please

    • #101183

      mi000001
      Participant

      Bump please…

    • #101500

      mi000001
      Participant

      Merry Christmas Anna, can you please check this out. Thank you.

  • #101539

    Anna
    Keymaster

    Hi Guys

    I apologize but I never got this message. For urgent issues please use our private ticket system – http://support.wpestate.org/ The Budddypress plugin we use for this forum has some issues when it comes to new emails and we don’t recommend to use the forum unless it’s for public information that people wish to share. But for urgent matters always use the ticket system.

    Regarding the login issue with Gmail, here is what we know based on a client with non latin gmail account (which is a WordPress limitation)

    A client used for hebrew in formatting.php (should be where wordpress saves usernames) and for him it worked.

    Seems to me Arabic or Cyrilic, is the same for WordPress.

    URL https://wordpress.org/support/topic/username-in-hebrew

    Thank you
    Anna

  • #124137

    Fiz
    Participant

    Anybody found the fix for this ? Still same thing happening to Wpresidence.net also my site.

  • #124146

    Fiz
    Participant

    Hey,
    I have found the issue and its fix. I hope people would get help from this. In wpresidence/libs/3rdparty.php

    After Google provide you with the access token, it gets information from your User’s google profile. As we all know google have an option to display nickname as well and and full name is like NAME (Nick). and they are setting full name as your username but wordpress doesn’t allow brackets () in username. So i just extract the username from email and set it as wordpress username. below is code to fix the issue you can copy and replace the code in above mentioned file. I hope i helped.

    ////////////////////////////////////////////////////////////////////////////////
    /// estate_google_oauth_login  Login
    ////////////////////////////////////////////////////////////////////////////////
    if( !function_exists('estate_google_oauth_login') ):
    
    function estate_google_oauth_login($get_vars){
        set_include_path( get_include_path() . PATH_SEPARATOR . get_template_directory().'/libs/resources');
        $allowed_html   =   array();
        require_once 'src/Google_Client.php';
        require_once 'src/contrib/Google_Oauth2Service.php';
        $google_client_id       =   esc_html ( get_option('wp_estate_google_oauth_api','') );
        $google_client_secret   =   esc_html ( get_option('wp_estate_google_oauth_client_secret','') );
       $google_redirect_url    =   get_dashboard_profile_link();
        $google_developer_key   =   esc_html ( get_option('wp_estate_google_api_key','') );
    
        $gClient = new Google_Client();
        $gClient->setApplicationName('Login to GwadarLinks');
        $gClient->setClientId($google_client_id);
        $gClient->setClientSecret($google_client_secret);
        $gClient->setRedirectUri($google_redirect_url);
        $gClient->setDeveloperKey($google_developer_key);
        $google_oauthV2 = new Google_Oauth2Service($gClient);
        
        if (isset($_GET['code'])) { 
            $code=wp_kses($_GET['code'],$allowed_html);
            $gClient->authenticate($code);
    
        }
        
        
        
        if ($gClient->getAccessToken()) 
        {     
            $allowed_html      =   array();
            $dashboard_url     =   get_dashboard_profile_link();
            $user              =   $google_oauthV2->userinfo->get();
            $user_id           =   $user['id'];		
    		$split_email = explode( '@' , $user['email']);
    		$custom_username = $split_email[0];
    		$full_name         =   wp_kses($user['name'], $allowed_html);
            $email             =   wp_kses($user['email'], $allowed_html);
    
            $profile_url                      = filter_var($user['link'], FILTER_VALIDATE_URL);
            $profile_image_url                = filter_var($user['picture'], FILTER_VALIDATE_URL);
           
            
            
            
            $full_name=  str_replace(' ','.',$full_name);  
    
            wpestate_register_user_via_google($email,$custom_username,$user_id); 
            $wordpress_user_id=username_exists($custom_username);
            wp_set_password( $code, $wordpress_user_id ) ;
            
            $info                   = array();
            $info['user_login']     = $custom_username;
            $info['user_password']  = $code;
            $info['remember']       = true;
            $user_signon            = wp_signon( $info, false );
            
     
            
            if ( is_wp_error($user_signon) ){ 
                wp_redirect( home_url() );  
            }else{
                wpestate_update_old_users($user_signon->ID);
                wp_redirect($dashboard_url);
            }
        }
        
        
        
    }
    
    endif; // end   estate_google_oauth_login 
    


    Regards,
    Fiz
    fayzanzahid.com

You must be logged in to reply to this topic.