supabase-rb-rb
Auth

Resend an OTP

Resend a signup confirmation, magic-link, SMS OTP, or change-confirmation email.

Re-trigger a one-time-password or confirmation email/SMS via GoTrue's POST /resend endpoint. Use this when the user reports they never received the original message (mailbox delays, mistyped phone number) or when the previous code expired.

The type: parameter selects which flow is being resent — it must match the flow that originally generated the message (you cannot turn a signup into a recovery by resending).

Does not require an active session. Like the original send, resends are rate-limited server-side.

Signature

supabase.auth.resend(credentials)

credentials is a hash — pass a literal or use Ruby's hash-literal shorthand.

Parameters

NameTypeRequiredDescription
typeStringRequiredWhich flow to resend: "signup" or "email_change" for email confirmation links, "sms" or "phone_change" for SMS OTPs.
emailStringOptionalUser email. Required for signup / email_change resends. If both email and phone are passed, email takes priority and only email is sent on the wire.
phoneStringOptionalUser phone number in E.164 format. Required for sms / phone_change resends.
optionsHashOptionalNested options: email_redirect_to (String, URL embedded in the resent confirmation email; ignored for SMS), captcha_token (String).

At least one of email: or phone: is required — calling resend with neither raises Supabase::Auth::Errors::AuthInvalidCredentialsError.

Returns

Returns
Supabase::Auth::Types::AuthOtpResponse

A Struct with :message_id, :user, and :session. For resends user and session are nil (the flow is not yet complete); message_id is the GoTrue-side identifier for the message that was queued. Treat a successful return as "the resend was accepted" — no session is established until verify_otp is called with the code.

Example — resend a signup confirmation

response = supabase.auth.resend(
  email: "ada@example.com",
  type: "signup",
  options: { email_redirect_to: "https://app.example.com/auth/confirmed" }
)

response.message_id

Example — resend an SMS OTP

supabase.auth.resend(
  phone: "+15555550123",
  type: "sms"
)

Example — resend an email-change confirmation

# The user already called update_user(email: "ada.new@example.com") but the
# confirmation email got lost. Resend it to the *new* address:
supabase.auth.resend(
  email: "ada.new@example.com",
  type: "email_change",
  options: { email_redirect_to: "https://app.example.com/auth/email-changed" }
)

When both email: and phone: are supplied, phone: is dropped and only email: is sent on the wire. The accepted type: vocabulary and rate-limiting are GoTrue-side.

On this page