public function loginRegisterCallback($client)
{
// uncomment this to see which attributes you get back
//echo "<pre>";print_r($client->getUserAttributes());echo "</pre>";exit;
// check if user is already logged in. if so, do nothing
if (!Yii::$app->user->isGuest) {
return;
}
// attempt to log in as an existing user
if ($this->attemptLogin($client)) {
return;
}
// register a new user
$userAuth = $this->initUserAuth($client);
$this->registerAndLoginUser($client, $userAuth);
}