Yet another issue with Google
-
Hello. After I’ve tried all suggested solutions, I have come to the same errors many people write on forum.
Legacy People API has not been used in project etc..I have activated Google + Api and People API, thus the problem insists and everytime I try to login/sigup, the log.txt shows the same URL
Enable it by visiting https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project=20920975420
The problem is that the URL is dead and I cannot locate what other APIs I must open…
-
Hi there,
We found the problem and as soon as possible we will send an update.
Meantime replace the file that you can find at this link Google.php , in/wp-content/plugins/yith-woocommerce-social-login-premium/includes/hybridauth/Hybrid/Providers/Great it worked… the only issue I see now is Username invalid and it prompts me to /wp-login.php?ywsl_social=google
Is it something I still need to work on ?Facebook works great
Hi there,
Does the google email you are using to log in belongs to an account already registered?I’ve tried with two different gmail accounts. Both were greek, dunno if that matters for username
That error shows up likely is due to the displayName being empty. You can add these lines below around line 95 within getUserProfile() function in the new Google.php from the post above.
Line 94: $this->user->profile->zip = ( property_exists( $response, 'zip' ) ) ? $response->zip : ""; // Add these new lines if ( empty($this->user->profile->displayName) ) { $this->user->profile->displayName = $this->user->profile->firstName . " " . $this->user->profile->lastName; }New function should look like
function getUserProfile() { // refresh tokens if needed $this->refreshToken(); $response = $this->api->api( "https://www.googleapis.com/oauth2/v3/userinfo" ); if ( ! isset( $response ) ) { throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData( $response ), 6 ); } $this->user->profile->identifier = ( property_exists( $response, 'sub' ) ) ? $response->sub : ""; $this->user->profile->firstName = ( property_exists( $response, 'name' ) ) ? $response->given_name : ""; $this->user->profile->lastName = ( property_exists( $response, 'name' ) ) ? $response->family_name : ""; $this->user->profile->displayName = ( property_exists( $response, 'displayName' ) ) ? $response->name : ""; $this->user->profile->photoURL = ( property_exists( $response, 'picture' ) ) ? $response->picture : ""; $this->user->profile->profileURL = ( property_exists( $response, 'url' ) ) ? $response->url : ""; $this->user->profile->description = ( property_exists( $response, 'aboutMe' ) ) ? $response->aboutMe : ""; $this->user->profile->gender = ( property_exists( $response, 'gender' ) ) ? $response->gender : ""; $this->user->profile->language = ( property_exists( $response, 'locale' ) ) ? $response->locale : ""; $this->user->profile->email = ( property_exists( $response, 'email' ) ) ? $response->email : ""; $this->user->profile->emailVerified = ( property_exists( $response, 'email' ) ) ? $response->email_verified : ""; $this->user->profile->phone = ( property_exists( $response, 'phone' ) ) ? $response->phone : ""; $this->user->profile->country = ( property_exists( $response, 'country' ) ) ? $response->country : ""; $this->user->profile->region = ( property_exists( $response, 'region' ) ) ? $response->region : ""; $this->user->profile->zip = ( property_exists( $response, 'zip' ) ) ? $response->zip : ""; if ( empty($this->user->profile->displayName) ) { $this->user->profile->displayName = $this->user->profile->firstName . " " . $this->user->profile->lastName; } if ( property_exists( $response, 'placesLived' ) ) { $this->user->profile->city = ""; $this->user->profile->address = ""; foreach ( $response->placesLived as $c ) { if ( property_exists( $c, 'primary' ) ) { if ( $c->primary == true ) { $this->user->profile->address = $c->value; $this->user->profile->city = $c->value; break; } } else { if ( property_exists( $c, 'value' ) ) { $this->user->profile->address = $c->value; $this->user->profile->city = $c->value; } } } } // google API returns multiple urls, but a "website" only if it is verified // see http://support.google.com/plus/answer/1713826?hl=en if ( property_exists( $response, 'urls' ) ) { foreach ( $response->urls as $u ) { if ( property_exists( $u, 'primary' ) && $u->primary == true ) { $this->user->profile->webSiteURL = $u->value; } } } else { $this->user->profile->webSiteURL = ''; } // google API returns age ranges min and/or max as of https://developers.google.com/+/web/api/rest/latest/people#resource if ( property_exists( $response, 'ageRange' ) ) { if ( property_exists( $response->ageRange, 'min' ) && property_exists( $response->ageRange, 'max' ) ) { $this->user->profile->age = $response->ageRange->min . ' - ' . $response->ageRange->max; } else { if ( property_exists( $response->ageRange, 'min' ) ) { $this->user->profile->age = '>= ' . $response->ageRange->min; } else { if ( property_exists( $response->ageRange, 'max' ) ) { $this->user->profile->age = '<= ' . $response->ageRange->max; } else { $this->user->profile->age = ''; } } } } else { $this->user->profile->age = ''; } // google API returns birthdays only if a user set 'show in my account' if ( property_exists( $response, 'birthday' ) ) { list( $birthday_year, $birthday_month, $birthday_day ) = explode( '-', $response->birthday ); $this->user->profile->birthDay = (int) $birthday_day; $this->user->profile->birthMonth = (int) $birthday_month; $this->user->profile->birthYear = (int) $birthday_year; } else { $this->user->profile->birthDay = 0; $this->user->profile->birthMonth = 0; $this->user->profile->birthYear = 0; } return $this->user->profile; }Great thanks.. will that be implemented on next version ?
Hi @darnpunk,
thanks for your suggestion, we’ll send a plugin update with this fix
The topic ‘Yet another issue with Google’ is closed to new replies.