ngo*_*vin 9 javascript firebase firebase-authentication
我在 localhost 上使用 Firebase 身份验证(firebase v7.23.0)。邮件发送没问题。我单击电子邮件中的登录链接。我在我的 <PROJECT>.firebaseapp.com 上收到此错误页面
我的代码主要在下面,但这一切都有效。这是 Firebase 页面出现错误。我不确定还需要设置什么。localhost 位于允许的域中。该错误位于 Firebase 端,因此我无法进行太多调试或修复。
const actionCodeSettings = {
// URL you want to redirect back to. The domain (www.example.com) for this
// URL must be whitelisted in the Firebase Console.
// url: `${window.location.protocol}//${window.location.host}/`,
url: http://localhost:7000/#postLogin,
// This must be true.
handleCodeInApp: true
};
firebase.auth().sendSignInLinkToEmail(this.email, actionCodeSettings)
.then(() => {
// The link was successfully sent. Inform the user.
// Save the email locally so you don't need to ask the user for it again.
window.localStorage.setItem('email', this.email);
})
.catch(error => {
// Some error occurred, you can inspect the code: error.code
});
}
Run Code Online (Sandbox Code Playgroud)
我不确定你是如何获得这个网址的。您从网址中删除了 apiKey 以附加屏幕截图,或者您配置了一些错误,导致 apiKey 未包含在电子邮件验证链接中。
为了测试我的假设,我创建了新的 firebase 应用程序并将其部署到https://test-auth-79dae.firebaseapp.com/,其中只有一个发送电子邮件链接按钮,该按钮可以向我自己发送电子邮件,并且如果我单击,电子邮件链接就会起作用电子邮件中收到验证链接。仅当我从电子邮件中的链接中删除 apiKey 时,它才不起作用。
您的电子邮件链接应该是:
https://test-auth-79dae.firebaseapp.com/__/auth/action?apiKey={yourApiKey}&oobCode={obbCode}&continueUrl={urlParameter}&lang=en
归档时间: |
|
查看次数: |
6940 次 |
最近记录: |