@@ -52,6 +52,8 @@ public static Client Instance
52
52
public string AuthUrl { get ; private set ; }
53
53
public string Schema { get ; private set ; }
54
54
55
+ private SupabaseOptions options ;
56
+
55
57
private Client ( ) { }
56
58
57
59
@@ -88,6 +90,7 @@ public static async Task<Client> InitializeAsync(string supabaseUrl, string supa
88
90
if ( options == null )
89
91
options = new SupabaseOptions ( ) ;
90
92
93
+ instance . options = options ;
91
94
instance . RestUrl = string . Format ( options . RestUrlFormat , supabaseUrl ) ;
92
95
instance . RealtimeUrl = string . Format ( options . RealtimeUrlFormat , supabaseUrl ) . Replace ( "http" , "ws" ) ;
93
96
instance . AuthUrl = string . Format ( options . AuthUrlFormat , supabaseUrl ) ;
@@ -139,10 +142,18 @@ public static async Task<Client> InitializeAsync(string supabaseUrl, string supa
139
142
internal Dictionary < string , string > GetAuthHeaders ( )
140
143
{
141
144
var headers = new Dictionary < string , string > ( ) ;
142
- var bearer = Auth ? . CurrentSession ? . AccessToken != null ? Auth . CurrentSession . AccessToken : SupabaseKey ;
143
-
144
145
headers [ "apiKey" ] = SupabaseKey ;
145
- headers [ "Authorization" ] = $ "Bearer { bearer } ";
146
+
147
+ // In Regard To: https://github.com/supabase/supabase-csharp/issues/5
148
+ if ( options . Headers . ContainsKey ( "Authorization" ) )
149
+ {
150
+ headers [ "Authorization" ] = options . Headers [ "Authorization" ] ;
151
+ }
152
+ else
153
+ {
154
+ var bearer = Auth ? . CurrentSession ? . AccessToken != null ? Auth . CurrentSession . AccessToken : SupabaseKey ;
155
+ headers [ "Authorization" ] = $ "Bearer { bearer } ";
156
+ }
146
157
147
158
return headers ;
148
159
}
0 commit comments