diff --git a/src/features/authentication/components/AuthenticationSteps/OtpVerifyForm.tsx b/src/features/authentication/components/AuthenticationSteps/OtpVerifyForm.tsx index 7ff7d16..101ef19 100644 --- a/src/features/authentication/components/AuthenticationSteps/OtpVerifyForm.tsx +++ b/src/features/authentication/components/AuthenticationSteps/OtpVerifyForm.tsx @@ -174,6 +174,33 @@ export function OtpVerifyForm({ const otpMessage = otpMessageFn(); + useEffect(() => { + let cancelled = false; + + const run = async () => { + if (!('OTPCredential' in window)) return; + + try { + const ac = new AbortController(); + + const otp = await (navigator as any).credentials.get({ + otp: { transport: ['sms'] }, + signal: ac.signal, + }); + + if (!cancelled && otp?.code) { + setOtpCode(otp.code); + } + } catch { } + }; + + run(); + + return () => { + cancelled = true; + }; + }, []); + return (