Reputation: 11
Sorry people, I'm really new in Yii2 framework!!
I'm trying to do a web login using "yiisoft/yii2-authclient" at version 2.2.14 After client autentication, nothing happen and the new user is not logged in and the auth table is empty
I state that I created a new module /common/modules/user/ModuleUser.php and instead of handle the auth action in SiteController I do it in /common/modules/user/controllers/DefaultController.php in where I placed all the user actions such as login, logout and so on.
I set behaviours() to allow access to each those action
'access' => [
'class' => AccessControl::class,
'rules' => [
[
'actions' => ['login', 'auth',...],
'allow' => true,
],
],
],
I set action and callback in this way
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'onAuthSuccess']
],
public function onAuthSuccess($client)
{
(new AuthHandler($client))->handle();
}
It seems this onAuthSuccess() function is never called.
Procedure starts at /user/default/auth?authclient=facebook|google
Both clients, facebook and google, on user succefully autenticated, bounce to the correct redirect url
/user/default/auth?authclient=facebook&code=AQDxqg....
but nothing happens, and it seems successCallback is not invoked, no errors occurred, even on apache level.
I really don't understand what I'm doing wrong... Please help!
Upvotes: 1
Views: 243
Reputation: 11
Shame on me, I made so stupid mistake while moving files in common/modules/user/: I forgot to adjust namespace into class AuthHandler, and some other little mess with "use" declarations for that class...
Upvotes: 0