@@ -12,7 +12,7 @@ import { fetchWithAuth } from './lib/fetch'
12
12
import { isBrowser , stripTrailingSlash } from './lib/helpers'
13
13
import { SupabaseAuthClient } from './lib/SupabaseAuthClient'
14
14
import { SupabaseRealtimeClient } from './lib/SupabaseRealtimeClient'
15
- import { Fetch , GenericSchema , SupabaseClientOptions } from './lib/types'
15
+ import { Fetch , GenericSchema , SupabaseClientOptions , SupabaseAuthClientOptions } from './lib/types'
16
16
17
17
const DEFAULT_OPTIONS = {
18
18
schema : 'public' ,
@@ -93,17 +93,17 @@ export default class SupabaseClient<
93
93
this . functionsUrl = `${ _supabaseUrl } /functions/v1`
94
94
}
95
95
96
- this . multiTab = settings . multiTab
96
+ this . multiTab = settings . auth ?. multiTab ?? false
97
97
this . headers = { ...DEFAULT_HEADERS , ...options ?. headers }
98
98
this . shouldThrowOnError = settings . shouldThrowOnError || false
99
99
100
100
this . fetch = fetchWithAuth ( supabaseKey , this . _getAccessToken . bind ( this ) , settings . fetch )
101
101
102
- this . auth = this . _initSupabaseAuthClient ( settings )
102
+ this . auth = this . _initSupabaseAuthClient ( settings . auth || { } , this . headers , this . fetch )
103
103
this . realtime = this . _initRealtimeClient ( { headers : this . headers , ...settings . realtime } )
104
104
this . rest = new PostgrestClient ( `${ _supabaseUrl } /rest/v1` , {
105
105
headers : this . headers ,
106
- schema : options ?. schema ,
106
+ schema : options ?. db ?. schema ,
107
107
fetch : this . fetch ,
108
108
throwOnError : this . shouldThrowOnError ,
109
109
} )
@@ -261,16 +261,18 @@ export default class SupabaseClient<
261
261
return this . realtime . channels as RealtimeChannel [ ]
262
262
}
263
263
264
- private _initSupabaseAuthClient ( {
265
- autoRefreshToken,
266
- persistSession,
267
- detectSessionInUrl,
268
- localStorage,
269
- headers,
270
- fetch,
271
- cookieOptions,
272
- multiTab,
273
- } : SupabaseClientOptions < string > ) {
264
+ private _initSupabaseAuthClient (
265
+ {
266
+ autoRefreshToken,
267
+ persistSession,
268
+ detectSessionInUrl,
269
+ localStorage,
270
+ cookieOptions,
271
+ multiTab,
272
+ } : SupabaseAuthClientOptions ,
273
+ headers ?: Record < string , string > ,
274
+ fetch ?: Fetch
275
+ ) {
274
276
const authHeaders = {
275
277
Authorization : `Bearer ${ this . supabaseKey } ` ,
276
278
apikey : `${ this . supabaseKey } ` ,
0 commit comments