yii\authclient\AuthAction::authOpenId PHP Method

authOpenId() protected method

Performs OpenID auth flow.
protected authOpenId ( OpenId $client ) : Response
$client OpenId auth client instance.
return yii\web\Response action response.
    protected function authOpenId($client)
    {
        if (!empty($_REQUEST['openid_mode'])) {
            switch ($_REQUEST['openid_mode']) {
                case 'id_res':
                    if ($client->validate()) {
                        return $this->authSuccess($client);
                    } else {
                        throw new HttpException(400, 'Unable to complete the authentication because the required data was not received.');
                    }
                    break;
                case 'cancel':
                    $this->redirectCancel();
                    break;
                default:
                    throw new HttpException(400);
                    break;
            }
        } else {
            $url = $client->buildAuthUrl();
            return Yii::$app->getResponse()->redirect($url);
        }
        return $this->redirectCancel();
    }