使用AngularFire进行Firebase用户身份验证

时间:2015-08-28 19:07:23

标签: javascript angularjs firebase angularfire

我正在尝试使用AngularFire通过Github对用户进行身份验证,但我一直收到错误:

  

ref.authWithOAuthPopup不是函数

这是我的控制器代码:

.controller('HomeCtrl', ['$scope', function($scope) {
    var ref = new Firebase("https://<MY-FIREBASE-APP>.firebaseio.com");
    function authHandler(error, authDat) {
        if (error) {
            console.log("Login Failed!", error);
        } else {
            console.log("Authenticated successfully with payload: ", authData);
        }
    }
    ref.authWithOAuthPopup("github", authHandler);
}]);

1 个答案:

答案 0 :(得分:0)

原来我使用的是旧版本或firebase本身......我使用的是版本1.0.18,而当前版本是2.2.9。