Skip to content

fix: clarify error message when token missing email or phone in verify endpoint#2376

Open
AKASH10513 wants to merge 3 commits intosupabase:masterfrom
AKASH10513:fix-verify-error-message
Open

fix: clarify error message when token missing email or phone in verify endpoint#2376
AKASH10513 wants to merge 3 commits intosupabase:masterfrom
AKASH10513:fix-verify-error-message

Conversation

@AKASH10513
Copy link

@AKASH10513 AKASH10513 commented Feb 15, 2026

…hone

What kind of change does this PR introduce?

Bug fix / validation improvement

What is the current behavior?

The POST /verify endpoint returns confusing validation errors when request
parameters are invalid.
Specifically:
when both token and token_hash are provided
when neither is provided
when token is provided without email or phone
when token_hash is provided along with other fields
The validation logic enforces specific parameter combinations, but the
error message does not clearly explain what is wrong, which can confuse developers.

What is the new behavior?

This change only improves the error message and does not modify the existing
validation logic or verification flow.
The change has not been tested in a running Supabase instance yet,
but it is limited to validation messaging and does not affect core logic.

Additional context

Add any other context or screenshots.

Summary by CodeRabbit

  • Bug Fixes
    • Clarified token verification error: when a token is supplied but neither email nor phone is provided, users now see the clearer message — "When verifying with a token, you must provide either an email address or a phone number" — to reduce confusion.

@AKASH10513 AKASH10513 requested a review from a team as a code owner February 15, 2026 19:22
@coderabbitai
Copy link

coderabbitai bot commented Feb 15, 2026

📝 Walkthrough

Walkthrough

Changed a single validation error message in token-based verification to require either an email address or a phone number; no control flow or logic changes.

Changes

Cohort / File(s) Summary
Error Message Update
internal/api/verify.go
Replaced validation error text with: "When verifying with a token, you must provide either an email address or a phone number". No behavior changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: clarifying an error message in the verify endpoint when a token is provided without email or phone.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@internal/api/verify.go`:
- Line 81: Update the validation error message in the return statement that
calls apierrors.NewBadRequestError (in internal/api/verify.go) to correct the
typo and improve wording: remove the stray space before "phone" and replace
"phone no" with "phone number" so the message reads clearly (e.g., "When
verifying with a token, you must provide either an email address or phone
number"). Ensure the message string used in the apierrors.NewBadRequestError
call is updated accordingly.

@AKASH10513 AKASH10513 changed the title fix(auth): improve verify error message when token missing email or p… fix: clarify error message when token missing email or phone in verify endpoint Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant