我使用yii2-authclient进行用户登录
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'yii\authclient\clients\GoogleOAuth',
'clientId' => '*********',
'clientSecret' => '*********',
'returnUrl'=>'http://mywebsite/frontend/web/index.php?r=site/auth?authclient=google',
],在主计长中:
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'successCallback'
],但是,在从google重定向到http://mywebsite/frontend/web/index.php?r=site/auth?authclient=google之后,它显示错误没有找到(#404)。
发布于 2022-03-23 07:12:07
我在SecurityController中使用了下面的代码,在我的情况下它可以正常工作,所以可以检查下面的代码吗?
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'onAuthSuccess'],
],
];
}
public function onAuthSuccess($client)
{
write your success code here.
}https://stackoverflow.com/questions/38732494
复制相似问题