amnah\yii2\user\controllers\AuthController::initUserAuth PHP Method

initUserAuth() protected method

Initialize a userAuth model based on $client data. Note that we don't set user_id yet because that can either be the currently logged in user OR a user matched by email address
protected initUserAuth ( BaseClient $client ) : amnah\yii2\user\models\UserAuth
$client yii\authclient\BaseClient
return amnah\yii2\user\models\UserAuth
    protected function initUserAuth($client)
    {
        /** @var \amnah\yii2\user\models\UserAuth $userAuth */
        // build data. note that we don't set `user_id` yet
        $attributes = $client->getUserAttributes();
        $userAuth = $this->module->model("UserAuth");
        $userAuth->provider = $client->name;
        $userAuth->provider_id = (string) $attributes["id"];
        // parse out google id
        $idCheck = strpos($userAuth->provider_id, "o8/id?id=");
        if ($idCheck !== false) {
            $userAuth->provider_id = substr($userAuth->provider_id, $idCheck + 9);
        }
        $userAuth->setProviderAttributes($attributes);
        return $userAuth;
    }