S
S
Sergey Pugovkin2016-09-03 20:29:09
JavaScript
Sergey Pugovkin, 2016-09-03 20:29:09

Yii2: how to make authorization through social networks without a redirect, but by calling a javascript callback function?

I raise a question to which there is no answer:
stackoverflow.com/questions/36512143/yii2-authacti...
It is necessary to make authorization through social networks without a redirect, but by calling the javascript callback function, passing parameters to it. So far I've done this:

public function actions()
{
    return [
        'auth' => [
            'class' => 'yii\authclient\AuthAction',
            'successCallback' => function ($client) {
                $provider = $client->id;
                $userAttributes = $client->userAttributes;
                Yii::$app->response->format = Response::FORMAT_JSON;
                Yii::$app->response->data = [
                    'provider' => $provider,
                    // ...
                ];
            },
        ],
    ];
}

As a result, after authorization, json data is displayed in the open popup window. What to do next?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2016-09-04
@Driver86

Look at the source, everything is simple there. If my memory serves me, then the redirect is just performed through js
window.location =...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question