我正在尝试在Yii用户管理插件上设置混合身份验证,文档在这里https://github.com/thyseus/yii-user-management/blob/master/user/docs/hybridauth.txt
根据这一步
Take the modules/user/vendors/index.php, rename it to 'hybridauth.php' and place it
beside your application index.php bootstrap script. This will be your hybrid auth
entry script.
为此,modules/user/vendors/index.php
中没有index.php文件,但modules/user/vendors/hybridauth/index.php
中有一个我重命名为hybridauth.php
并将其放入http://localhost/dev/
内容的require_once( "protected/modules/user/vendors/hybridauth/Hybrid/Auth.php" );
require_once( "protected/modules/user/vendors/hybridauth/Hybrid/Endpoint.php" );
Hybrid_Endpoint::process();
内容hybridauth.php是
Place the hybrid auth configuration file into your application
protected/config/hybridauth.php.
现在为此
modules/user/vendors/hybridauth/config.php
我带了protected/config/
并将其放入return
array(
"base_url" => Yii::app()->createAbsoluteUrl('/').'/hybridauth.php',
"providers" => array (
...........
"Google" => array (
"enabled" => true,
"keys" => array (
"id" => "ID",
"secret" => "SECRET",
),
),
"Facebook" => array (
"enabled" => true,
"keys" => array (
"id" => "ID",
"secret" => "SECRET",
),
"scope" => "email,user_birthday" // https://developers.facebook.com/docs/reference/login/
),
),
// if you want to enable logging, set 'debug_mode' to true then provide a writable file by the web server on "debug_file"
"debug_mode" => false,
"debug_file" => "",
);
并将 config.php 重命名为 hybridauth.php 。内容看起来像这样
http://localhost/dev/index.php/hybridauth.php?hauth.start=Facebook&hauth.time=1388044835
问题是当我点击登录页面上的facebook图标上的说法时,它会显示我的主页面。 (的index.php)
这里也是它指向的链接
http://localhost/dev/hybridauth.php?hauth.start=Facebook&hauth.time=1388044835
当我从网址
中删除index.php时{{1}}
我收到此错误
您无法直接访问此页面。
知道我做错了什么吗?感谢
答案 0 :(得分:0)
这听起来像是配置中的路由问题:
你可能想为hybridauth.php添加一个路由并确保它只能通过GET访问
例如:
'components'=>array(
......
'urlManager'=>array(
'showScriptName' => false,
'urlFormat'=>'path',
'rules'=>array(
'hybridauth'=>array('user/hybridauth/index', 'verb'=>'GET', 'urlSuffix'=>'.php'),
....
),
),
),
答案 1 :(得分:0)
如果有人有同样的问题,这就是我如何解决它:
通过将base_url更改为指向实际的php文件:
"base_url" => Yii::app()->getBaseUrl(true).'/hybridauth.php',
答案 2 :(得分:0)
如果您使用YUM用户管理尝试导入
Yii::import('application.modules.profile.models.*');
在YumUsar AuthController上,因为无法找到个人资料。