google auth的auth状态参数无效

w7t8yxp5  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(178)

我使用的是yii2authclient扩展,当我尝试登录到谷歌时,我被重定向到 https://localhost/yii2/frontend/web/index.php?r=user%2Fsecurity%2Fauth&authclient=google&state=a210c7124891a0083463a&code=4%2F0AX4XfWgAhMrw6CVtm4cj8-&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&authuser=0&prompt=none 我得到400分 Invalid auth state parameter. 错误

yii\web\HttpException: Invalid auth state parameter. in C:\xampp\htdocs\yii2\vendor\yiisoft\yii2-authclient\src\OAuth2.php:122
Stack trace:

# 0 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2-authclient\src\AuthAction.php(417): yii\authclient\OAuth2->fetchAccessToken('4/0AX4XfWgAhMrw...')

# 1 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2-authclient\src\AuthAction.php(227): yii\authclient\AuthAction->authOAuth2(Object(Da\User\AuthClient\Google), Array)

# 2 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2-authclient\src\AuthAction.php(210): yii\authclient\AuthAction->auth(Object(Da\User\AuthClient\Google))

# 3 [internal function]: yii\authclient\AuthAction->run()

# 4 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Action.php(94): call_user_func_array(Array, Array)

# 5 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Controller.php(181): yii\base\Action->runWithParams(Array)

# 6 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Module.php(534): yii\base\Controller->runAction('auth', Array)

# 7 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\web\Application.php(104): yii\base\Module->runAction('user/security/a...', Array)

# 8 C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Application.php(392): yii\web\Application->handleRequest(Object(yii\web\Request))

# 9 C:\xampp\htdocs\yii2\frontend\web\index.php(39): yii\base\Application->run()

# 10 {main}

我也在使用 yii\web\DbSession 当我改变 yii\web\DbSessionyii\web\Session 它起作用了。我怎样才能让它工作 yii\web\DbSession ?
我的会话表如下所示

CREATE TABLE `yiisession` (
  `id` char(40) NOT NULL,
  `expire` int(11) NOT NULL,
  `data` longblob NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

在我的 main.php ```
'session' => [
'class' => 'yii\web\DbSession',
'sessionTable' => 'yiisession',
]

附加信息
infoversionyii版本2.0.42.1yii身份验证客户端版本2.2HP版本8.0.8

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题