javascript - 使用谷歌登录后重定向到另一个页面 - Firebase Web
问题描述
一切正常。使用谷歌登录正在工作。我想知道我需要在我的 googlesignin 函数中添加什么,以便在使用 google 登录后,它被重定向到 facebook.html 页面?
按钮代码
<button onclick="googleSignin()">Google Signin</button>
function googleSignin(){
base_provider = new firebase.auth.GoogleAuthProvider()
firebase.auth().signInWithRedirect(base_provider).then(function(result){
console.log(result)
console.log("Success.. Google Account Linked")
}).catch(function(err){
console.log(err)
console.log("Failed to do")
})
}
解决方案
我找到了答案,我想和大家分享。
function googleSignin(){
base_provider = new firebase.auth.GoogleAuthProvider()
firebase.auth().signInWithPopup(base_provider).then(function(result){
window.location="facebook.html";
console.log(result)
console.log("Success.. Google Account Linked")
}).catch(function(err){
console.log(err)
console.log("Failed to do")
})
}
推荐阅读
- python-3.x - Does networkx's weighted edge_betweenness_centrality algorithm need distances or similarities would work too?
- c++ - 如何避免每次通过 openmp for 循环重新初始化向量?
- node.js - 500 内部服务器错误”,错误:“TypeError:无法读取未定义的属性 'id'
- powerbi - 如何根据总值显示柱形图值
- json - 访问 Google 表格上的 API 响应
- pytorch - 直接更新优化器学习率
- regex - .htaccess:“RewriteRule ^ -”和“RewriteRule ^(.*)$ /$1”有什么区别?
- javascript - 如何为 chrome 创建 vpn 扩展
- php - 多个 WHERE 子查询性能
- bash - bash根据数组查找值替换字符串