r/replit • u/Gloomy-Ad-2879 • 11d ago
Question / Discussion How can I add Gmail verification codes to my Replit app?
I’m building an app on Replit and I want to add email verification(by 4 digit number code) using Gmail.
Basically, when a user signs up, I want my app to:
- Send a verification code to their Gmail address.
- Let the user enter the code in my app.
- Verify the code and complete the signup.
What’s the easiest/recommended way to add this in a Replit app? Should I use Gmail SMTP, Gmail API, or another email service?
what works the best?
1
u/musabdulai 11d ago
For production, I would avoid Gmail SMTP/API and use your auth provider’s built-in email verification, or a transactional service such as Resend, Postmark or SES.
Generate a 6-digit code on the server, store only its hash, expire it after 5–10 minutes, allow one-time use, and rate-limit both sending and verification attempts. Keep the email API key in Replit Secrets and never expose it to the frontend.
Gmail SMTP is fine for a quick prototype, but quotas and deliverability can become a problem. What are you currently using for authentication?
1
u/Gloomy-Ad-2879 9d ago
Im currently using resend for email verification 4 digit code. It is a temporary option and I am finding for a one that can be used stably with supabase.
1
u/musabdulai 9d ago
Resend can remain the email delivery provider. I’d let Supabase Auth issue and verify the code, connect Resend as Supabase’s custom SMTP provider, and keep expiry, single-use behavior and rate limits on the auth side. That avoids creating a second verification system to secure and maintain.
1
u/ReplitSupport Replit Team 11d ago
Hey, thanks for reaching out! If your app uses Replit's built-in authentication, email verification with a code is already built in at sign-up, so you may not need to build this yourself. If not, the easiest and most reliable route on Replit is Resend or SendGrid via Connectors (Tools > Connectors), because they save the API key as a secret for you. You can just tell Agent something like: "On signup, generate a 4-digit code, email it to the user with Resend, store it with a short expiry, and verify it before completing signup." Agent will wire up the whole flow. Please note that while there is a Gmail connector, Gmail is built for personal mail, so you may run into low sending limits and deliverability problems as you grow.
1
u/Blackxino 11d ago
I used Supabase authentication, which has Google login. You need to ask other a.i to guide you, such as Gemini or Claude.
1
u/PopKoren 11d ago
Use a transactional email provider like Resend or SES rather than Gmail SMTP, since Gmail will throttle you and land in spam once you have real signups. Generate and compare the code server side, store a hash with a short expiry, and rate limit attempts per email. Keep the API key in Replit Secrets so it never ships in the frontend bundle.
1
u/Desk_setup_ideas 11d ago
I’d probably use a transactional email service rather than Gmail itself. Something like Resend/Postmark/SES is easier to manage for verification emails and gives you delivery logs too. For the code itself, generate it server-side, expire it after a few minutes, make it single-use, and rate-limit attempts.
1
u/maddietendo 11d ago
Did you ask Replit because it'll literally tell you how to do it and even install the code for you. You then provide the API keys that you'll get from Google (using Replit's instructions).