gpt4 book ai didi

php - yii2 Google OAuth 成功重定向到 404

转载 作者:行者123 更新时间:2023-12-05 06:41:58 25 4
gpt4 key购买 nike

我正在使用 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',

],

在 Controller 中:

'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'successCallback'
],

但是从谷歌重定向到 http://mywebsite/frontend/web/index.php?r=site/auth?authclient=google'它显示错误未找到 (#404)

最佳答案

我在 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.
}

关于php - yii2 Google OAuth 成功重定向到 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38732494/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com