[英]RN Firebase: Request passwordless sign-in on mobile, open link on PC, get signed-in on mobile?
I've successfully set up a passwordless sign-in flow on mobile (using dynamic links ).我已经在移动设备上成功设置了无密码登录流程(使用动态链接)。 It works on iOS and Android, as long as the sign-in link is opened on the same mobile device.
只要登录链接在同一移动设备上打开,它就可以在 iOS 和 Android 上运行。
I would like to support the scenario where users sign-in on mobile, but open the link on their PC .我想支持用户在手机上登录,但在他们的 PC 上打开链接的场景。 Is this even possible?
这甚至可能吗?
When clicking the link on the PC, I currently see an empty page, with the URL configured in my ActionCodeSettings
:单击 PC 上的链接时,我目前看到一个空白页面,在我的
ActionCodeSettings
中配置了 URL :
const actionCodeSettings: FirebaseAuthTypes.ActionCodeSettings = {
handleCodeInApp: true,
url: 'https://the-url-i-see',
iOS: {
bundleId: '...',
},
android: {
packageName: '...',
installApp: true,
},
}
Which parts are missing on my end?我的末端缺少哪些部分?
UPDATE更新
I'm one step closer: I created an index.html
to be served via https://the-url-i-see
:我又近了一步:我创建了一个
index.html
以通过https://the-url-i-see
服务:
if (firebase.auth().isSignInWithEmailLink(window.location.href)) {
email = window.prompt('Please provide your email for confirmation');
firebase.auth().signInWithEmailLink(email, window.location.href).then(() => {
console.log('Sign-in successful')
}).catch(e => {
console.error('Sign-in failed', e)
})
}
What works now:现在有效:
index.html
index.html
What is still missing:还缺少什么:
Mobile app is not notified about the sign-in (specifically, onAuthStateChanged
handler is not firing).移动应用程序不会收到有关登录的通知(具体而言,
onAuthStateChanged
处理程序未触发)。
Meanwhile I've learned that this is not how Firebase Auth works.同时我了解到这不是 Firebase Auth 的工作方式。 My new understanding, overly simplified:
我的新理解,过于简化:
firebase.auth()
realm (which will trigger onAuthStateChanged
in this realm)firebase.auth()
realm (将在此领域触发onAuthStateChanged
)TL;DR: Passwordless sign-in across devices is not supported out-of-the-box TL;DR:开箱即用不支持跨设备无密码登录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.