【问题标题】:HybridAuth getUserProfile returns Trying to get property of non-objectHybridAuth getUserProfile 返回尝试获取非对象的属性
【发布时间】:2016-04-15 12:27:40
【问题描述】:

我在 google、FB 和 Twitter 上使用 HybridAuth,而 FB 工作得很好,google 返回空的用户资料。

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 } } } } 

知道要检查什么吗?

【问题讨论】:

  • #CLOSED 好的,它已修复。项目中似乎需要启用 Google+ API。

标签: oauth google-oauth hybridauth


【解决方案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+ api, 并且在传播过程中需要等待一段时间

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-10
    • 2019-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-29
    相关资源
    最近更新 更多