File tree 1 file changed +4
-6
lines changed 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -318,26 +318,24 @@ export default class SupabaseClient<
318
318
}
319
319
320
320
private _listenForAuthEvents ( ) {
321
- let data = this . auth . onAuthStateChange ( async ( event , session ) => {
322
- await this . _handleTokenChanged ( event , 'CLIENT' , session ?. access_token )
321
+ let data = this . auth . onAuthStateChange ( ( event , session ) => {
322
+ this . _handleTokenChanged ( event , 'CLIENT' , session ?. access_token )
323
323
} )
324
324
return data
325
325
}
326
326
327
- private async _handleTokenChanged (
327
+ private _handleTokenChanged (
328
328
event : AuthChangeEvent ,
329
329
source : 'CLIENT' | 'STORAGE' ,
330
330
token ?: string
331
331
) {
332
- // On token change, call Realtime's `setAuth` to sync auth and connections.
333
- // Realtime handles token retrieval internally which may involve customizations, so we don't pass the token directly.
334
- await this . realtime . setAuth ( )
335
332
if (
336
333
( event === 'TOKEN_REFRESHED' || event === 'SIGNED_IN' ) &&
337
334
this . changedAccessToken !== token
338
335
) {
339
336
this . changedAccessToken = token
340
337
} else if ( event === 'SIGNED_OUT' ) {
338
+ this . realtime . setAuth ( )
341
339
if ( source == 'STORAGE' ) this . auth . signOut ( )
342
340
this . changedAccessToken = undefined
343
341
}
You can’t perform that action at this time.
0 commit comments