Web平台上的authWithOAuthPopup错误

时间:2015-07-08 14:18:50

标签: javascript facebook firebase firebasesimplelogin

我正在尝试在网页上使用Firebase的Facebook身份验证,但我收到此错误:

Login failed Error: Invalid authentication credentials provided.
at Error (native)
at http://45.55.203.213/js/firebase.js:160:367
at e (http://45.55.203.213/js/firebase.js:140:400)

这是我的Javascript代码:

var ref = new Firebase("https://fantasy-smash-bros.firebaseio.com/");

function FBLogin() {
    ref.authWithOAuthPopup("facebook", function(error, authData) {
        if (error) {
            console.log("Login failed", error);
        } else {
            loginWithAuthData(authData);
        }
    });
}

function loginWithAuthData(authData) {
    username = authData.facebook.displayName;
    avatarURL = authData.facebook.cachedUserProfile.picture.data.url;
    userID = authData.facebook.id;
}

function attemptLogin() {
    var user = ref.getAuth();
    if (user) {
        loginWithAuthData(user);
    } else {
        $("#fb-login").click(function () {
            FBLogin();
        });
    }
}

$(document).ready(function () {
    attemptLogin();
});

注意:我已导入firebase.js。 Here's我使用过的Javascript副本。

我相信我已正确设置所有内容:将Firebase的回调网址添加到我的Facebook应用的白名单中,在Firebase应用上启用Facebook身份验证。但我仍然难以接受该做什么。任何帮助将不胜感激。

0 个答案:

没有答案