Firebase Google登录

问题描述:

Firebase不推荐使用FirebaseSimpleLogin,因此我们一直试图实施新的authWithOAuthPopup,但我们不断收到控制台错误:TypeError:undefined不是函数。Firebase Google登录

var app = angular.module("myApp", ["firebase"]); 

app.controller("appCtrl", function($scope, $firebase) { 

var ref = new Firebase("https://[forge].firebaseio.com/users"); 

// Login using Google 
$scope.loginGoogle = function() { 
    console.log("Got into google login"); 
    ref.authWithOAuthPopup("google", function(error, authData) { 
     console.log("yeah, we got in! " + user.uid); 
    }, { 
      remember: "sessionOnly", 
      scope: "email" 
    }); 
}; 


$scope.logout = function() { 
    ref.unauth(); 
    }; 


}); 

我在做什么错?

一定要使用最新版本的火力地堡的,否则也不会明白ref.authWithOAuthPopup方法

下面是最新版本:https://cdn.firebase.com/js/client/2.0.2/firebase.js

委派的身份验证方法(即通过OAuth认证供应商,或电子邮件/密码等)已于2014年10月3日添加到Firebase核心客户端库中,并且需要该日期或之后的客户端库(对于Web客户端,> = 1.1.0)。

抓住最新的网络客户端库,并查看更新日志,在https://www.firebase.com/docs/web/changelog.html