【发布时间】:2014-01-13 21:45:38
【问题描述】:
我正在尝试在 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/ 的 hybridauth.php 内容中
require_once( "protected/modules/user/vendors/hybridauth/Hybrid/Auth.php" );
require_once( "protected/modules/user/vendors/hybridauth/Hybrid/Endpoint.php" );
Hybrid_Endpoint::process();
现在开始
Place the hybrid auth configuration file into your application
protected/config/hybridauth.php.
我将modules/user/vendors/hybridauth/config.php 放入protected/config/ 并将config.php 重命名为hybridauth.php。内容是这样的
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" => "",
);
问题是当我点击登录页面上的 Facebook 图标时,它会显示我的主页。 (index.php)
这里也是它指向的链接
http://localhost/dev/index.php/hybridauth.php?hauth.start=Facebook&hauth.time=1388044835
当我从 url 中删除 index.php 时
http://localhost/dev/hybridauth.php?hauth.start=Facebook&hauth.time=1388044835
我收到这个错误
您无法直接访问此页面。
知道我做错了什么吗?谢谢
【问题讨论】:
标签: yii yii-extensions yii-modules