Overview
This guide shows how to implement email OTP authentication using@turnkey/react-native-wallet-kit in an Expo app.
We’ll trigger an OTP to a user’s email address, navigate to a verification screen, and verify the 6-digit code.
Before you begin:
- Ensure you’ve completed the provider setup from Getting Started and enabled the Auth Proxy with Email OTP in the Turnkey Dashboard.
- In your
TurnkeyProviderconfig, make sureauth.otp.emailis enabled (or enabled via dashboard). See Getting Started for the full provider example.
Request an OTP (email)
Create or update your login screen to request an email OTP usinginitOtp. The snippet below uses Expo Router to navigate to an otp screen with the returned otpId and the email address.
app/index.tsx
Verify the OTP code
On a separateotp screen, read the email and otpId from the route and call completeOtp with the user-entered 6-digit code.
app/otp.tsx
Notes
- Default OTP length is 6; if you’ve customized OTP in the dashboard, validate accordingly.
- If you need to resend a code, you can call
initOtpagain with the same email.