Fix · Supabase and databases
"Invalid API key" or 401 from Supabase
Blocks your workSecurity
What you may see
- Every request from my app answers 401
- It started after I changed or copied the keys
Most likely cause
The key is missing, copied with a space or a line break, belongs to another project, or was rotated.
Check first (about two minutes)
- Check the project address and the key are from the SAME project (the same short project id in the address).
- Check for a space or line break at the start or end of the saved variable value.
The fix prompt
What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.
Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.
Prompt language
Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.
After you tried it, did it work?
Steps
- List which variable names the app reads for the address and key (names only).
- Check the code uses the public key for the browser and that the same names exist in the host's settings for the right environment.
- Tell me how to copy the keys again from the project's API settings page (it may be labelled differently), re-save them, and redeploy.
Do not do this
- Do not paste keys into chat.
- Do not print the key to check it.