public function oAuthSuccess($client)
 {
     // get user data from client
     $userAttributes = $client->getUserAttributes();
     $email = $userAttributes['emails'][0]['value'];
     $player = Player::findByEmail($email);
     if ($player == null) {
         $player = new Player();
         $player->email = $email;
         if (isset($userAttributes['image']) && isset($userAttributes['image']['url'])) {
             $photo = explode('?', $userAttributes['image']['url'])[0];
             $player->photo = $photo;
         }
         if (isset($userAttributes['name'])) {
             $player->first_name = $userAttributes['name']['givenName'];
             $player->last_name = $userAttributes['name']['familyName'];
         }
         $player->generateAuthKey();
         $player->generateAccessToken();
         $player->save();
     }
     if (Yii::$app->user->login($player, 3600 * 24 * 30)) {
         return $this->redirect(Url::previous());
     }
 }