我试图在这个简单的php网站上进行HybridAuth社交登录.下载HybridAuth并安装它.然后发现即使这些示例也不适用于社交登录(在远程服务器上也尝试过).
正常的signin_signup示例工作正常.但每当我点击链接登录社交网络(即facebook,twitter)时,它会将我重定向到(MY_BASE_URL/index.php?hauth.start = Facebook&hauth.time),而根本不显示任何登录窗口/错误消息.
我仔细阅读了此处发布的文档和其他解决方案.调整我的config.php以获得一个基本网址,如http://example.com/index.php.但它只是没有回应.有什么我想念的吗?我已经花了两天时间.
这是我的config.php
return
array(
"base_url" => "http://example.com/index.php",
"providers" => array (
// openid providers
"OpenID" => array (
"enabled" => false
),
"AOL" => array (
"enabled" => false
),
"Yahoo" => array (
"enabled" => false,
"keys" => array ( "id" => "", "secret" => "" )
),
"Google" => array (
"enabled" => true,
"keys" => array ( "id" => "", "secret" => "" )
),
"Facebook" => array (
"enabled" => …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将Google联合登录与首要应用帐户集成,但我遇到了一些问题.
当我将请求发送到:https://www.google.com/accounts/o8/ud
带有所有参数(见下文)时,我会返回a request_token
和要求的属性列表Attribute Exchange
.这是完美的,因为我们需要通过属性传递(AX)的电子邮件将用户存储在我们的应用程序数据库中,并且我们需要未来的请求令牌API requests to scopes
(即:日历,联系人等).
但是,使用该URL(此处称为endpoint
)不会使用户登录其托管应用程序(gmail,日历等),这是一个问题.
更改端点以https://www.google.com/a/thedomain.com/o8/ud?be=o8
更改所有内容.我自动登录到其他谷歌应用程序(Gmail等).但是,使用该端点,我只通过AX 获取请求令牌或属性.显然那不是特别混合.非常一个或那个.
对端点的示例请求 https://www.google.com/accounts/o8/ud
parameters = {
'openid.ns': 'http://specs.openid.net/auth/2.0',
'openid.claimed_id': 'http://specs.openid.net/auth/2.0/identifier_select',
'openid.identity': 'http://specs.openid.net/auth/2.0/identifier_select',
'openid.return_to':'http://our.domain.com/accounts/callback/',
'openid.realm': 'http://our.domain.com/',
'openid.assoc_handle': assoc_handle,
'openid.mode': 'checkid_setup',
'openid.ns.ext2': 'http://specs.openid.net/extensions/oauth/1.0',
'openid.ext2.consumer': 'our.domain.com',
'openid.ext2.scope': 'https://mail.google.com/mail/feed/atom',
'openid.ns.ax':'http://openid.net/srv/ax/1.0',
'openid.ax.mode':'fetch_request',
'openid.ax.required':'firstname,lastname,email',
'openid.ax.type.firstname':'http://axschema.org/namePerson/first',
'openid.ax.type.lastname':'http://axschema.org/namePerson/last',
'openid.ax.type.email':'http://axschema.org/contact/email',
}
return HttpResponseRedirect(end_point + '?' + urllib.urlencode(parameters))
Run Code Online (Sandbox Code Playgroud)
(assoc_handle先前由openid初始请求成功设置)
我一直在努力让这种Hybird方法正常工作,对抗最不透明的错误信息(This page is invalid
...感谢Google)以及缺乏一致的文档.我已经拖曳了每个代码示例,我可以到达这一点.任何帮助,将不胜感激 ...
任何机构可以帮助如何获取Twitter电子邮件我在php codeigniter中使用此链接我在这里收到我的信息,除了电子邮件.然后如何获取电子邮件?是否我们在配置文件中指定了任何范围?
我已经使用HybridAuth在我的Facebook应用程序中授权用户,并将他的access_token存储在我的数据库中.
几天后,当用户不在线时,我想要使用HybridAuth获得他的新Facebook好友.
我可以从他的access_token中重新创建该用户以获取他的朋友,发送通知等吗?
谢谢!
我正在使用HybridAuth2和CakePHP,我的控制器功能是
public function loginwith($provider) {
// $this->autoRender = false;
require_once( WWW_ROOT . 'hybridauth/Hybrid/Auth.php' );
$hybridauth_config = array(
"base_url" => 'http://' . $_SERVER['HTTP_HOST'] . $this->base . "/hybridauth/", // set hybridauth path
"providers" => array(
"Google" => array(
"enabled" => true,
"keys" => array("id" => "clientID", "secret" => "clientSecret")
)
)
);
try {
// create an instance for Hybridauth with the configuration file path as parameter
$hybridauth = new Hybrid_Auth($hybridauth_config);
// try to authenticate the selected $provider
$adapter = $hybridauth->authenticate($provider);
// …
Run Code Online (Sandbox Code Playgroud) 谈到Hybid Auth,我正在使用Facebook登录用户,但我不知道我在代码中修改了什么导致系统显示"抱歉,此页面无法直接访问"消息.
当系统检查文件hybridauth/hybridauth/index.php中是否已存在Hybrid_Auth会话时,我发现它与$ _SESSION ["HA :: CONFIG"]变量有关
你能告诉我怎么解决这个问题?
问题
我想friends_location
从Facebok Graph API中获取.我正在使用HybridAuth框架访问API .我如何返回朋友的位置/家乡等?
我的应用权限
我为我的应用设置了以下权限:
friends_about_me,friends_location,friends_hometown,user_location,email,user_birthday,offline_access,user_hometown
这是用户在Facebook上看到的权限请求屏幕:
我曾经尝试过什么
我尝试了以下方法来获取朋友的详细信息:
HybridAuth: $hybrid->getUserContacts();
和
原生API: $hybrid->api()->api('/me/friends');
两者都返回以下格式而没有朋友的位置:
{"identifier": "12345678","displayName": "Joe Smith",},
我也看到了这个问题,但我已经friends_about_me
在我的请求中包含了许可.
有没有人试图在CodeIgniter中集成HybridAuth?
我正在尝试配置HybridAuth,我还处于早期阶段.现在我要做的就是连接并确保HA将重定向到facebook并提示安装应用程序,然后在用户返回时对用户进行身份验证.
我手动调用以下内容:http: //mydomain.com/auth.php?provider = Facebook
auth.php看起来像这样:
session_start();
require_once($_SERVER['DOCUMENT_ROOT'] . "/func/db_connect.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/api/auth/Hybrid/Auth.php"); // HybridAuth Module
$hybridauth_config = include($_SERVER['DOCUMENT_ROOT'] . '/api/auth/config.php');
if ($_GET['provider'] == '' || !in_array($_GET['provider'], array_keys($hybridauth_config['providers']))) {
echo 'Invalid Provider';
} else {
try {
$hybridauth = new Hybrid_Auth($hybridauth_config);
// try to authenticate with this provider
$adapter = $hybridauth->authenticate($_GET['provider']);
// grab user profile
if ($hybridauth->isConnectedWith($f_provider)) {
// yep, we're connected. Add this provider's info to the user_auth table
echo 'connection successful';
}
} catch (Exception $e) …
Run Code Online (Sandbox Code Playgroud) php ×6
hybridauth ×4
facebook ×3
oauth ×3
openid ×2
cakephp ×1
codeigniter ×1
python ×1
twitter ×1