小编Nat*_*ate的帖子

为什么Firebase拾取的Facebook用户ID与Facebook Graph中与同一帐户关联的Facebook ID不同?

我已将Facebook身份验证与Firebase集成到我的网站中。我正在使用Firebase JavaScript API。

我正在使用的代码直接从Firebase教程中获得,该教程标题为“ User Login&Authentication”(用户登录和身份验证),网址为https : //www.firebase.com/docs/web/guide/user-auth.html

var myRef = new Firebase("https://#######.firebaseio.com");
var auth = new FirebaseSimpleLogin(myRef, function(error, user) {
    if (error) {
        // an error occurred while attempting login
        console.log(error);
    } else if (user) {
        // user authenticated with Firebase
        console.log("User ID: " + user.id + ", Provider: " + user.provider);
    } else {
        // user is logged out
    }
});
auth.login("facebook");
Run Code Online (Sandbox Code Playgroud)

所有这些都可以很好地工作,并记录正确的信息。

但是,记录的ID(即在Firebase仪表板中的数据中可见的用户ID)与我通过Facebook Graph获得的Facebook ID不同。

使用Firebase,我得到一个17位数字的用户ID。使用Facebook Graph(https://developers.facebook.com/tools/explorer?method=GET&path=me%3Ffields%3Did%2Cname&version=v2.0),我得到了一个9位数的用户ID。

这意味着我无法使用Firebase登录,获取Facebook ID和通过Facebook Graph进行请求-同一用户的用户ID不同。

为什么存在这种差异?如何使用Firebase获取与Facebook Graph中显示的相同的Facebook …

javascript facebook-graph-api firebase

5
推荐指数
1
解决办法
2612
查看次数

标签 统计

facebook-graph-api ×1

firebase ×1

javascript ×1