New secret API keys (sb_secret_...) return 401 on PostgREST and Auth admin but work on Storage #52680
|
Project ref: gvfuhykpegzyqktddnca (Free plan, region eu-central-1) Our new secret API keys (sb_secret_..., both the auto-created "default" one and a newly created one) are accepted by the Storage API but rejected with an empty-body HTTP 401 on the Data API (PostgREST) and on Auth admin. What we tested (same key each time, project restarted once, on 2026-10-07):
Context: the JWT Signing Keys page shows current key = ECC (P-256) and previous key = Legacy HS256 (rotated about a month before the test). PostgREST 14.5, Auth 2.197.0, Postgres 17.6.1.166. Question: is something missing on our project for the Data API and Auth to accept the new secret keys? We want to migrate off the legacy service_role JWT and then revoke the legacy HS256 key. We opened a support ticket (SU-497409) on 2026-10-07 and only received the automatic acknowledgement. Thank you. |
Replies: 1 comment 1 reply
|
the first thing i'd rule out is where the requests come from. secret keys are blocked for browsers: Supabase matches on the quick check from a terminal, with the key only on curl -i "https://<project-ref>.supabase.co/rest/v1/articles?select=id&limit=1" \
-H "apikey: sb_secret_..."also keep the new keys off if plain curl with only |
the first thing i'd rule out is where the requests come from. secret keys are blocked for browsers: Supabase matches on the
User-Agentheader and returns 401 (API keys docs). if the REST and Auth tests ran from a browser console, from a REST client that sends a browser user agent, or from code that runs in the browser, that alone gives you a 401 with an empty bodyquick check from a terminal, with the key only on
apikey:also keep the new keys off
Authorization: Bearer. they aren't JWTs, and the docs say to send them onapikey(see "Known limitations" on the same page)if plain cu…