parity(functions): never send new-format API key as Authorization Bearer [from supabase-js]
@Tr00d is already working on this.
Since Jul 17, 2026.
Assessment
This issue has not been assessed yet.
Description
SDK Parity: C# implementation needed
A change was made in supabase-js that needs to be implemented in this repository for SDK parity.
Reference Implementation (supabase-js)
What Changed
New-format API keys (sb_publishable_… / sb_secret_…) must never be sent as a Bearer token. Edge Functions calls now use a dedicated fetch path where apikey always carries the key and Authorization only carries a real session JWT — with no session and a new-format key, no Bearer key fallback is sent. Legacy JWT keys are unaffected.
Code Reference
this.functionsFetch = fetchWithAuth(
supabaseKey, supabaseUrl, this._getSessionToken.bind(this),
settings.global.fetch, settings.tracePropagation,
{ omitApiKeyAsBearer: true }
)
Confirmed in supabase-csharp: Supabase/Client.cs:256-275 GetAuthHeaders() sets bearer = Auth.CurrentSession?.AccessToken ?? _supabaseKey and Authorization: Bearer {bearer} when there's no session — meaning the raw Supabase key (including new-format sb_publishable_/sb_secret_) is sent as the Bearer token whenever no session exists. This is the exact bug supabase-js fixed, and it applies to Functions invoke() as well since it shares this header path.
Implementation Guidance
Expected API Surface
Functions invoke path needs its own header-resolution logic distinct from REST/Storage: apikey always carries the key; Authorization only carries a session JWT, never a new-format key. Legacy JWT keys keep existing Bearer fallback.
Acceptance Criteria
- Fix implemented matching supabase-js behavior
- Unit tests cover: no-session+new-key, no-session+legacy-key, has-session
- No breaking changes to existing legacy-key behavior
Context
- supabase-js version: v3.0.0-next.29 / 2.110.6
- Parity tracking: This issue was auto-generated by SDK parity analysis
- Related parity issues: supabase-flutter (SDK-1320), supabase-py (SDK-1325), supabase-swift (SDK-1329), supabase-kt (#1357)
Generated with Claude Code /sync-sdk-parity
- Dominant language
- C#
- Stars
- 701
- Forks
- 106
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 45
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/supabase-csharp
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
supabase/supabase-csharp#440 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
supabase/supabase-csharp#437 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
supabase/supabase-csharp#427 ·
-
supabase/supabase-csharp#409 · 1 comment · 1 assignee ·
-
area: realtime bug parity
supabase/supabase-csharp#393 · 1 assignee ·
All issues in supabase/supabase-csharp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100