Fix guide · updated 2026-11-16
Supabase "missing email or phone"
AuthApiError: missing email or phone · validation_failed · 400
Your login form fails with "missing email or phone", and the person did type their email. We ran Supabase's real Auth server and supabase-js 2.119 on our machine and tried every way a sign-in can lose the email on the way. The answer is always the same: the email was not in the request. The surprise: a phone login fails the same way when the object you pass also has an email key, even an empty one.
What the error means
supabase.auth.signInWithPassword() sends POST /auth/v1/token?grant_type=password. Supabase Auth reads three fields from the JSON body: email, phone and password. When email and phone are both empty or missing, it stops there, before it looks at the password or for an account. This is what the browser's Network tab shows:
400 {"code":"validation_failed","message":"missing email or phone"}
From curl, Postman or another language, without the version header supabase-js sends, the same error looks like this:
400 {"code":400,"error_code":"validation_failed","msg":"missing email or phone"}
So no account was checked and the password played no part: in our test, an empty password got this same error. The bug is in the request, not in the user.
1. The email was empty when the call ran
Each of these got "missing email or phone" in our test:
supabase.auth.signInWithPassword({ email: '', password }) // empty state
supabase.auth.signInWithPassword({ email: undefined, password }) // wrong variable or field name
supabase.auth.signInWithPassword({ email: null, password }) // formData.get('email') found no such field
An undefined email isn't even sent: the request body only had the password. The usual causes: the input isn't wired to the state your code reads (in React, a value with no onChange), the handler reads form.mail when the field is called email, or, with a server action, the input has no name="email", so formData.get('email') returns null.
Read the value from the form when it's submitted, trim it, and don't call Supabase without it:
<form onSubmit={onSubmit}>
<input name="email" type="email" autoComplete="email" required />
<input name="password" type="password" autoComplete="current-password" required />
</form>
async function onSubmit(event) {
event.preventDefault()
const form = new FormData(event.currentTarget)
const email = String(form.get('email') ?? '').trim()
const password = String(form.get('password') ?? '')
if (!email) return setError('Enter your email address.')
const { error } = await supabase.auth.signInWithPassword({ email, password })
if (error) setError(error.message)
}
The trim matters for the next error: in our test, " ana@lab.test " with spaces got "Invalid login credentials", because Supabase doesn't trim. Capitals were fine: Ana@Lab.test signed in.
2. Phone login: an email key in the same object wins
supabase-js picks the email path when the object has an email key, whatever its value, and then sends only the email. In our test, the phone number wasn't in the request at all:
supabase.auth.signInWithPassword({ email: '', phone: '+15555550100', password }) // missing email or phone
supabase.auth.signInWithPassword({ email: undefined, phone: '+15555550100', password }) // missing email or phone
This happens with one login form for both, which passes all its fields. Build the object with one key only:
const credentials = usePhone ? { phone, password } : { email, password }
const { error } = await supabase.auth.signInWithPassword(credentials)
A phone and password sign-in also needs the Phone provider turned on (Authentication → Sign In / Providers). With it off, the answer is 422 phone_provider_disabled "Phone logins are disabled".
3. You call the Auth API without supabase-js
From curl, Postman, Dart or Flutter, Python, or an API call in a no-code tool, Auth only reads email, phone and password at the top level of a JSON body. In our test:
{"username": "...", "password": "..."}, the usual OAuth habit: missing email or phone.{"user": {"email": "...", "password": "..."}}, nested: missing email or phone.{}: missing email or phone.{"EMAIL": "..."}signed in. The case of the key doesn't matter, its name does. A JSON body with no Content-Type header signed in too.- A form-encoded body (
application/x-www-form-urlencoded, what OAuth clients send):400 bad_json"Could not parse request body as JSON: unexpected end of JSON input". Auth reads the form while looking forgrant_type, and no JSON is left after that. - An empty body: the same
bad_json. JSON encoded twice, so the body is a string: "cannot unmarshal string into Go value of type api.PasswordGrantParams".
The request that works:
curl -X POST 'https://YOUR-PROJECT.supabase.co/auth/v1/token?grant_type=password' \
-H 'apikey: YOUR-PUBLISHABLE-OR-ANON-KEY' \
-H 'Content-Type: application/json' \
-d '{"email":"ana@example.com","password":"your-password"}'
4. Mistakes that never reach Supabase
supabase-js checks the object before it sends anything. These made no request at all in our test, so your Supabase logs won't show them:
signInWithPassword({ username, password })or{ Email, password }:AuthInvalidCredentialsError"You must provide either an email or phone number and a password". Here the key's case does matter.signInWithPassword(email, password), two arguments instead of one object: it throwsTypeError: Cannot use 'in' operator to search for 'email' in ana@lab.test. It's thrown, not returned inerror, so the page crashes unless you catch it.
And two that do reach Supabase but get 400 bad_json instead: an email that is an object (an input element, an event, { value }), and a custom global.fetch in createClient that passes on the method and headers but not the body. Pass everything on: fetch(url, { ...init, headers }).
The same empty email on other calls
An empty email gets a different message on each Auth call. All are 400 validation_failed except sign-up, and the fix is the same as in part 1:
signInWithOtp({ email: '' }): "One of email or phone must be set".resetPasswordForEmail(''): "Password recovery requires an email".resend({ type: 'signup', email: '' }): "Type provided requires an email address".verifyOtp({ email: '', token, type: 'email' }): "Only an email address or phone number should be provided on verify", although neither was.signUp({ email: '', password }): 422 "Anonymous sign-ins are disabled", see that guide.
If an AI tool built your app
Give your AI tool this prompt:
On the login form, read the email and password from the form when it is submitted (each input needs a name attribute), trim the email, and if it's empty show "Enter your email address." and don't call Supabase. Pass supabase.auth.signInWithPassword one object with either { email, password } or { phone, password }, never both keys. Don't change anything else.
Not quite your error?
- The email arrives but the sign-in is refused: Supabase "Invalid login credentials".
- The account exists but isn't confirmed: Supabase "Email not confirmed".
- Sign-up refuses the address: Supabase "Unable to validate email address: invalid format".
- Sign-up with an empty email: Supabase "Anonymous sign-ins are disabled".
Still stuck?
Open the failed token?grant_type=password request in your browser's Network tab and look at its payload. If it shows "email":"" or no email at all, the bug is in the code that builds the object: log that object right before you call signInWithPassword.
Other Supabase problems? See Supabase fixes.