Error during authorization through VK. How to fix?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
Good time of day. Make authorization through SOC. network through the extension yiisoft/yii2-authclient. Set up Twitter and ADEX, and authorization went fine.
But the problem is that I can't do for Vkontakte. I added my clientId and clientSecret in the code given below. In config added (by the same way set up and Twitter with Adexa):
'vkontakte' => [ 'class' => 'yii\\authclient\\clients\\VKontakte', 'clientId' => '*******', 'clientSecret' => '*************', ],

I formed the links on this page here (It's all displayed on the page

In the settings for VK, there is a form:
The question is, what should I enter in field "Authorized redirect URI".
For example for Yandex need to specify a link
But VK says "Authorized redirect URI, which will be transmitted through OAuth authorization. Must contain the Protocol. Cannot include URL parameters, fragments and relative paths". Contact even does not preserve links with a GET parameter.
But if:
1. Do not write in this box, you receive the error:
array_shift() expects parameter 1 to be array, null given

And refers to the file: "vendor\\yiisoft\\yii2-authclient\\clients\\VKontakte.php"
2. - same as in item No. 1
This error is thrown when writing the paragraphs No. 3, 4, 5:
{"error":"invalid_request","error_description":"redirect_uri is incorrect, check the application redirect uri in the settings page"}

What should I write?
For earlier thanks a lot))
by | 35 views

2 Answers

0 like 0 dislike
In General, he was in agony with this problem. Maybe someone can help (don't claim to be the best way to solve):
I changed urlManager'e the link below it looked like
Plus I had to override a single class. And voila!
class AuthAction extends BaseAuthAction { protected function authOAuth2($client) { if ($client->getName() === 'vkontakte') { $client->setReturnUrl(Yii::$app->urlManagerFrontend->createAbsoluteUrl(['/user/sign-in/oauth/vkontakte'])); } return parent::authOAuth2($client); } }
0 like 0 dislike
What version introduced a mandatory parameter v. In this case you can just override the method.

/** * @inheritdoc */ public function applyAccessTokenToRequest($request, $accessToken) { $data = $request->getData(); $data['v'] = '3.0'; $data['uids'] = $accessToken->getParam('user_id'); $data['access_token'] = $accessToken->getToken(); $request->setData($data); }

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 2, 2019 by djienbaev97
0 like 0 dislike
3 answers
0 like 0 dislike
3 answers
asked Apr 26, 2019 by good_beginer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
40,796 users