无法使用Firebase中的电子邮件链接重新进行身份验证

时间:2019-08-26 20:51:42

标签: javascript firebase firebase-authentication

我的Web应用程序中有电子邮件链接登录设置,并且工作正常。但是,在执行特定操作之前,我需要重新认证用户。

我正在使用以下代码重新进行身份验证:

let credential = firebase.auth.EmailAuthProvider.credentialWithLink(userEmail, window.location.href);

firebase.auth().currentUser.reauthenticateWithCredential(credential).then(function (usercred: any) {
     console.log('Reauthentication test successful.');
}).catch(function (error: any) {
     console.log('Reauthentication test failed.');
});

但是,证书每次都会引发错误:

code: "auth/argument-error"
message: "Invalid email link!"

即使我尝试更改URL,也是如此。网址已在控制台中授权,并且为https(我最初是在localhost上进行测试的,当时认为可能是问题所在)。

有什么想法吗?

0 个答案:

没有答案
相关问题