HybridAuth getUserProfile返回Trying以获取非对象的属性

时间:2016-01-11 08:57:19

标签: oauth google-oauth hybridauth

我正在使用HybridAuth进行谷歌,FB和Twitter,而对于FB工作正常,谷歌会返回空的用户个人资料。

AccessToken没问题

getUserProfile()数据设置为NULL:

object(Hybrid_User)#8 (3) { ["providerId"]=> string(6) "Google" ["timestamp"]=> int(1452502079) ["profile"]=> object(Hybrid_User_Profile)#9 (22) { ["identifier"]=> NULL ["webSiteURL"]=> NULL ["profileURL"]=> NULL ["photoURL"]=> NULL ["displayName"]=> NULL ["description"]=> NULL ["firstName"]=> NULL ["lastName"]=> NULL ["gender"]=> NULL ["language"]=> NULL ["age"]=> NULL ["birthDay"]=> NULL ["birthMonth"]=> NULL ["birthYear"]=> NULL ["email"]=> NULL ["emailVerified"]=> NULL ["phone"]=> NULL ["address"]=> NULL ["country"]=> NULL ["region"]=> NULL ["city"]=> NULL ["zip"]=> NULL } } } } 

知道该检查什么?

1 个答案:

答案 0 :(得分:1)

只指向遇到相同行为的其他用户。 您可以通过在配置文件中添加参数来启用调试模式,就像这样

array(
    "base_url" => "", 
    "providers" => array (
        "Google" => array ( 
            "enabled" => true,
            "keys"    => array ( "id" => "", "secret" => "" )
        ),
        "Facebook" => array ( 
            "enabled" => true,
            "keys"    => array ( "id" => "", "secret" => "" )
        ),
        "Twitter" => array ( 
            "enabled" => true,
            "keys"    => array ( "key" => "", "secret" => "" ),
            "includeEmail" => true 
        ),
    ),

    // if you want to enable logging, set 'debug_mode' to true 
    "debug_mode" => false,
    // then provide a writable file by the web server on "debug_file"
    "debug_file" => "log.txt"
);

然后你可以检查日志,使用google用户数据是正确的,我们需要在google开发者控制台上启用google + api, 并且需要在传播期间等待一段时间