I’m using Yii2 and using these addons.
"yiisoft/yii2-authclient": "^2.2
"2amigos/yii2-usuario": "~1.0",
When I try to login using the social logins, it redirects to the main page. Doesn’t show any error and doesn’t log me in. When i login using the login form on my site, it works fine. Just the social login doesn’t do anything.
in my main, i changed my session to use DB
'session' => [
'class' => 'yii\web\DbSession'
'sessionTable' => 'session', // session table name. Defaults to 'session'.
'writeCallback' => function($session){
return [
'user_id' => Yii::$app->user->id
];
}
],
and
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'Da\User\AuthClient\Google',
'clientId' => 'xxxxxxxxxxxxxx1.apps.googleusercontent.com',
'clientSecret' => 'xxxxxxxxxxxxx',
'returnUrl' => 'https://localhost/yii2/frontend/web/index.php?r=user/security/auth&authclient=google',
],
really not sure whats going on, any ideas on what the issue is?
UPDATE:
I disabled my friendly URL, now im getting
[::1][-][k9g669nb7f4j6t88phd0kpjpuu][error][yii\web\HttpException:404] yii\web\NotFoundHttpException in C:\xampp\htdocs\yii2\vendor\2amigos\yii2-usuario\src\User\Controller\RegistrationController.php:
Stack trace:
#0 [internal function]: Da\User\Controller\RegistrationController->actionConnect('PfhyoAdaKOs8hHg...')
#1 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#2 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#3 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Module.php(534): yii\base\Controller->runAction('connect', Array)
#4 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\web\Application.php(104): yii\base\Module->runAction('user/registrati...', Array)
#5 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Application.php(392): yii\web\Application->handleRequest(Object(yii\web\Request))
#6 C:\xampp\htdocs\yii2\frontend\web\index.php(39): yii\base\Application->run()
#7 {main}
It works fine when the email is already in my user
table. but for new emails trying to register with their social account i get this error above. any ideas?
in my register form i have this
<?php
$authAuthChoice = AuthChoice::begin([
'baseAuthUrl' => ['/user/security/auth'],
'popupMode' => false
]);
?>
<?php foreach ($authAuthChoice->getClients() as $client): ?>
<?php
echo $authAuthChoice->clientLink(
$client,
'<span class="fab fa-'.$client->getName().' fa-2x"></span> <span class="d-none d-sm-block">Login using '.$client->getTitle().'</span><span class="d-block d-sm-none">'.$client->getTitle().'</span>',
[
'class' => 'btn btn-lg btn-block btn-social btn-'.$client->getName(),
]
);
?>
<?php endforeach; ?>
<?php AuthChoice::end(); ?>