HybridAuth for Facebook无效 [英] HybridAuth for Facebook Not Working

查看:61
本文介绍了HybridAuth for Facebook无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All;



我正在努力让HybridAuth在我的网站上运行,以便用户可以使用社交媒体帐户登录。有一次,我把它全部都用了,但由于一些不明确的原因,它现在没有。支持这个库似乎有点缺乏,我已经尝试完全删除它并读取它,一步一步地从网站上的教程。



错误:

致命错误:未捕获异常异常,消息验证失败! Facebook返回了无效的用户ID。''在D:\ ... \Scripts\OAuth\Hybrid\Auth.php:150堆栈跟踪:#0 D:\ ... \Scripts\ OAuth \Hybrid\Auth.php(39):Hybrid_Auth :: initialize(Array)#1 D:\ ... \ Scripts\socialLogin.php(20):Hybrid_Auth-> __ construct(Array)# 2 {D}投放在D:\ ... \Scripts\OAuth \Hybrid\Auth.php 150行



我当选不使用配置文件,而是在我调用库时手动构造一个配置数组,仅用于测试。当我真正开始工作时,我会使用配置文件。



这是来自socialLogin.php的代码,我正在调用的页面library:



Hello All;

I''m trying to get HybridAuth working on my website so users may login using a social media account. At one point, I had it all working, but for some unspecified reason, it now doesn''t. Support for this library seems somewhat lacking, and I''ve tried completely removing it and readding it, going step by step with the tutorials from the website.

The error:
Fatal error: Uncaught exception ''Exception'' with message ''Authentication failed! Facebook returned an invalid user id.'' in D:\...\Scripts\OAuth\Hybrid\Auth.php:150 Stack trace: #0 D:\...\Scripts\OAuth\Hybrid\Auth.php(39): Hybrid_Auth::initialize(Array) #1 D:\...\Scripts\socialLogin.php(20): Hybrid_Auth->__construct(Array) #2 {main} thrown in D:\...\Scripts\OAuth\Hybrid\Auth.php on line 150

I elected to not use the config file, but instead, manually construct a config array when I call the library, simply for testing. When I actually get it working, I''ll use the config file.

This is the code from socialLogin.php, the page where I''m calling the library:

<?php
    session_start();
    require_once("OAuth/Hybrid/Auth.php");

    if (isset($_GET["SMT"])){
        $type = $_GET["SMT"];

        switch($type) {
            case "Facebook":
                $config = array(
                  "base_url" => "[my site path]/Scripts/OAuth/",
                  "providers" => array (
                    "Facebook" => array (
                      "enabled" => true,
                      "keys"    => array ( "id" => "***", "secret" => "***" ),
                      "scope"   => "email, user_about_me, user_birthday, user_hometown", // optional
                      "display" => "popup" // optional
                )));

                $hybridAuth = new Hybrid_Auth($config);
                $adapter = $hybridAuth->authenticate("Facebook");
                $user_profile = $adapter->getUserProfile();
                print_r($user_profile);
            break;
        }
    }
?>





其他信息:

我的服务器没有SSL;我听说这可能是一个问题,所以我修改了base_facebook.php中的Curl Options来禁用SSL_VerifyPeer:





Additional info:
My server doesn''t have SSL; I heard this can be an issue, so I modified the Curl Options in the base_facebook.php to disable SSL_VerifyPeer:

public static $CURL_OPTS = array(
    CURLOPT_CONNECTTIMEOUT => 30,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 60,
    CURLOPT_USERAGENT      => 'facebook-php-3.2',
    CURLOPT_SSL_VERIFYPEER => false
  );





同样,只是为了获取更多信息,这里是关于登录的我的文件夹结构东西:

-root

--socialLogin.php

- 脚本

---- socialLogin。 php

---- OAuth

------混合

------ config.php

------ index.php



我已经在这里工作了几个小时,我根本不知道如何修复它。任何帮助将不胜感激。



As well, just for additional info, here''s my folder structure in regards to the login stuff:
-root
--socialLogin.php
--Scripts
----socialLogin.php
----OAuth
------Hybrid
------config.php
------index.php

I''ve been at this for hours, and I just have no idea how to fix it. Any help would be greatly appreciated.

推荐答案

_GET [ SMT])){
_GET["SMT"])){


type =
type =


_GET [ SMT];

开关(
_GET["SMT"]; switch(


这篇关于HybridAuth for Facebook无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆