我正在尝试配置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)