diff --git a/Supabase/Client.cs b/Supabase/Client.cs index 57a3012f..fecadf65 100644 --- a/Supabase/Client.cs +++ b/Supabase/Client.cs @@ -244,11 +244,14 @@ private void Auth_StateChanged(object sender, AuthState e) /// public Task Rpc(string procedureName, object? parameters) => _postgrest.Rpc(procedureName, parameters); - + /// public Task Rpc(string procedureName, object? parameters) => _postgrest.Rpc(procedureName, parameters); + /// + /// Produces dictionary of Headers that will be supplied to child clients. + /// internal Dictionary GetAuthHeaders() { var headers = new Dictionary @@ -257,9 +260,7 @@ internal Dictionary GetAuthHeaders() }; if (_supabaseKey != null) - { headers["apiKey"] = _supabaseKey; - } // In Regard To: https://github.com/supabase/supabase-csharp/issues/5 if (_options.Headers.TryGetValue("Authorization", out var header)) @@ -272,7 +273,11 @@ internal Dictionary GetAuthHeaders() headers["Authorization"] = $"Bearer {bearer}"; } + // Add supplied headers from `ClientOptions` by developer + foreach (var kvp in _options.Headers) + headers[kvp.Key] = kvp.Value; + return headers; } } -} \ No newline at end of file +}