如何在Next.js中使用Firebase添加OTP过期时间?

huangapple go评论71阅读模式
英文:

How can I add OTP expiry time in Next.js with Firebase?

问题

如何在Next.js Firebase中添加OTP过期时间

我在Firebase文档中搜索,但未找到关于我的问题的解决方案

这是我用于发送OTP的代码:

const appVerifier = window.recaptchaVerifier;

const phoneNumber = "+91" + mobile_no;

signInWithPhoneNumber(auth, phoneNumber, appVerifier).then((confirmationResult) => {
    // SMS sent. Prompt user to type the code from the message, then sign the
    // user in with confirmationResult.confirm(code).
    window.confirmationResult = confirmationResult;
    console.log("OTP已成功发送...");
    // ...
}).catch((error) => {
    // Error; SMS not sent
       
    console.log("由于以下原因未发送OTP:", error);
});
英文:

how to add OTP expire time in next js firebase

i search on firebase docs but i could'n find any solution about my problem

this is my code for sent otp

const appVerifier = window.recaptchaVerifier;

const phoneNumber = "+91" + mobile_no;

signInWithPhoneNumber(auth, phoneNumber, appVerifier).then((confirmationResult) => {
    // SMS sent. Prompt user to type the code from the message, then sign the
    // user in with confirmationResult.confirm(code).
    window.confirmationResult = confirmationResult;
    console.log("OTP SENT SUCCESSFULLY...");
    // ...
}).catch((error) => {
    // Error; SMS not sent
       
    console.log("OTP NOT SENT BECAUSE OF ===>", error);
});

</details>


# 答案1
**得分**: 0

以下是更新后的信息:

重置密码:重置密码链接的过期时间设置为1小时。

更改电子邮件通知:更改电子邮件通知链接的过期时间设置为6小时。

电子邮件验证:电子邮件验证链接的过期时间设置为3天。

电子邮件链接登录:电子邮件链接登录链接的过期时间设置为6小时。

OTP代码(手机认证):用于手机认证的OTP代码的过期时间设置为15分钟。

请注意,这些过期时间是预定义的,无法修改。此信息已通过Firebase团队的支持进行验证。

<details>
<summary>英文:</summary>

Here is the updated information:

Password reset: The expiration time for password reset links is set to 1 hour.

Email change notice: The expiration time for email change notice links is set to 6 hours.

Email verification: The expiration time for email verification links is set to 3 days.

Email link sign-in: The expiration time for email link sign-in links is set to 6 hours.

OTP code (phone auth): The expiration time for OTP codes used in phone authentication is set to 15 minutes.

Please note that these expiration times are predefined and cannot be modified. This information has been verified with the Firebase team support

</details>



huangapple
  • 本文由 发表于 2023年5月26日 16:16:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76338940.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定