Firebase authWithOAuthRedirect()惹恼了

Mar*_*coS 7 firebase firebase-security firebasesimplelogin

我正在尝试更新我的angularjs应用程序以支持Firebase 1.1(我坚持使用Firebase 1.0.x).
它弃用了firebasesimplelogin,包括Firebase核心内部的身份验证.

我已经能够使用成功实现身份验证

authWithOAuthPopup("<provider>", function(error, authData) { ... });
Run Code Online (Sandbox Code Playgroud)

它接受一个回调,它传递了身份验证数据authData.

相反,我不能不知道如何使用

authWithOAuthRedirect("<provider>", function(error) { ... });
Run Code Online (Sandbox Code Playgroud)

Firebase身份验证文档页面非常简洁...... :-(.这就是所说的:

或者[而不是authWithOAuthPopup],您可以提示用户使用完整的浏览器重定向进行登录,Firebase将在您返回原始页面时自动恢复会话

当Firebase - 重定向 - 返回到我的页面后,如何获取authData?

Fra*_*len 8

通过直接在ref上注册一个监听器可以获得authData(所以在调用之前authWithOAuthRedirect).

ref.onAuth(function(authData) { 
    ... 
} 
ref.authWithOAuthRedirect("google", function(error) { ... });
Run Code Online (Sandbox Code Playgroud)

请参阅https://www.firebase.com/docs/web/guide/user-auth.html#section-monitoring-authentication