public function successCallback($client)
    {
        $account = Social::find()->byClient($client)->one();
        if ($account === null) {
            $account = Social::create($client);
        }
        if ($account->user instanceof Yii::$app->user->id) {
            if ($account->user->isBlocked) {
                Yii::$app->session->setFlash('danger', Yii::t('oauth2', 'Your account has been blocked.'));
                $this->action->successUrl = Url::to(['/oauth2/auth/authorize']);
            } else {
                Yii::$app->user->login($account->user, $this->rememberFor);
                if ($this->isOauthRequest) {
                    $this->finishAuthorization();
                }
            }
        } else {
            $this->action->successUrl = Url::to(['/oauth2/auth/authorize']);
        }
    }
public function successCallback($client)
    {
        $account = Social::find()->byClient($client)->one();
        if ($account === null) {
            $account = Social::create($client);
        }
        if ($account->user instanceof Yii::$app->user->id) {
            if ($account->user->isBlocked) {
                Yii::$app->session->setFlash('danger', Yii::t('oauth2', 'Your account has been blocked.'));
                $this->action->successUrl = Url::to(['/oauth2/auth/authorize']);
            } else {
                Yii::$app->user->login($account->user, $this->rememberFor);
                if ($this->isOauthRequest) {
                    $this->finishAuthorization();
                }
            }
        } else {
            $this->action->successUrl = Url::to(['/oauth2/auth/authorize']);
        }
    }
public function successCallback ( $ client ) { $ account = Social :: find ( ) -> byClient ( $ client ) -> one ( ) ; if ( $ account === null ) { $ account = Social :: create ( $ client ) ; } if ( $ account -> user instanceof Yii :: $ app -> user -> id ) { if ( $ account -> user -> isBlocked ) { Yii :: $ app -> session -> setFlash ( 'danger' , Yii :: t ( 'oauth2' , 'Your account has been blocked.' ) ) ; $ this -> action -> successUrl = Url :: to ( [ '/oauth2/auth/authorize' ] ) ; } else { Yii :: $ app -> user -> login ( $ account -> user , $ this -> rememberFor ) ; if ( $ this -> isOauthRequest ) { $ this -> finishAuthorization ( ) ; } } } else { $ this -> action -> successUrl = Url :: to ( [ '/oauth2/auth/authorize' ] ) ; } }
OPTIONAL
Third party oauth callback sample
@param \yii\authclient\OAuth2 $client
OPTIONAL Third party oauth callback sample