Hybrid auth with Yii causing a redirect loop(Yii 的混合身份验证导致重定向循环)
问题描述
我正在尝试使用 hybridauth 在我的网站上实现 Twitter 登录.我知道 Yii 有一个混合身份验证插件.我没有使用它,因为我上次使用时遇到了一些问题.我正在尝试实现混合身份验证的核心版本.
I am trying to implement twitter sign in on my website using hybridauth. I know there is a hybrid auth plugin for Yii. I am not using it because last time I used I ran into some problems. I am trying to implement the core version of hybrid auth.
我在打电话
$hybridauth = new Hybrid_Auth( Yii::app()->params['hybridauth'] );
$adapter = $hybridauth->authenticate( 'Twitter');
但由于某种原因它重定向到 http://localhost/yiiauth/authtest/?hauth.start=Twitter&hauth.time=1350973441 ,这会导致重定向循环.有没有办法解决这个问题?我的混合身份验证配置如下:
But for some reason it redirects to http://localhost/yiiauth/authtest/?hauth.start=Twitter&hauth.time=1350973441 , which causes a redirect loop.
Is there any way to solve this problem ? My hybrid auth configuration is as follows :
'params'=>array(
'hybridauth'=>array(
"base_url" => "http://localhost/yiiauth/authtest/",
"providers" => array (
"Twitter" => array (
"enabled" => true,
"keys" => array ( "key" => "mykey", "secret" => "mysecret" )
),
),
"debug_mode" => false,
"debug_file" => "",
)
),
我的 hybridauth 文件位于 /protected/extensions/hybridauth 并且我在 index.php 文件的顶部包含了 Hybrid/Auth.php
My hybridauth files are in /protected/extensions/hybridauth and I include the Hybrid/Auth.php in the top of the index.php file
推荐答案
twitter 和 facebook 的混合身份验证登录需要一个有效的域,而不是本地主机.
Hybrid Auth login for twitter and facebook requires a valid domain not localhost.
您在配置文件hybridauth.php"中的base_url 应设置为/hauth/endpoint",即它必须指向端点.如果您已通过 .htaccess 删除 index.php,则使用/index.php/hauth/endpoint".
Your base_url in configuration file "hybridauth.php" should be set to "/hauth/endpoint" i.e. it must point to the endpoint. If you have removed index.php through .htaccess then use "/index.php/hauth/endpoint".
将 Logs 文件夹中的 hybridauth.log 权限设置为可写.
Set permissions of hybridauth.log in Logs folder to writable.
参考链接:http://hybridauth.sourceforge.net/userguide/Configuration.html一个>
这篇关于Yii 的混合身份验证导致重定向循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Yii 的混合身份验证导致重定向循环
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
