API testing · Auth API
Wrong password returns 500 Internal Server Error instead of 401
P3 · MinorIntermediateAuth API
Want to find it yourself first? This page gives away the answer. Play this bug on a fake app screen and see if you can spot it in three tries.
The clue
Whose mistake is a wrong password?
Steps to reproduce
- Send POST /api/login with a wrong password
Expected result
401 Unauthorized with “Invalid email or password”
Actual result
500 Internal Server Error with the same message
Why it matters
This is a minor (P3) bug. It does not stop anyone, but it looks careless and makes people trust the product less. It is usually fixed in a normal sprint.
Testing tip
4xx means the client did something wrong, 5xx means the server broke. Wrong codes set off false alarms and confuse retries.
How to find bugs like this
API bugs live in the JSON between the app and the server: wrong records returned, fields that leak private data, bad status codes and limits that are not enforced. When you test, try these checks:
- Read the whole response body, not only the status code.
- Ask for other users’ records on purpose.
- Look for fields that should never leave the server.
- Send values at and past every limit.