Skip to content

Commit b9c86f5

Browse files
authored
Revert "feat: Realtime using accessToken callback for auth (#1320)" (#1323)
This reverts commit 88a44df.
1 parent 88a44df commit b9c86f5

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@supabase/functions-js": "2.4.3",
4545
"@supabase/node-fetch": "2.6.15",
4646
"@supabase/postgrest-js": "1.16.3",
47-
"@supabase/realtime-js": "2.11.2",
47+
"@supabase/realtime-js": "2.10.9",
4848
"@supabase/storage-js": "2.7.1"
4949
},
5050
"devDependencies": {

src/SupabaseClient.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,7 @@ export default class SupabaseClient<
118118

119119
this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch)
120120

121-
this.realtime = this._initRealtimeClient({
122-
headers: this.headers,
123-
accessToken: this._getAccessToken,
124-
...settings.realtime,
125-
})
121+
this.realtime = this._initRealtimeClient({ headers: this.headers, ...settings.realtime })
126122
this.rest = new PostgrestClient(`${_supabaseUrl}/rest/v1`, {
127123
headers: this.headers,
128124
schema: settings.db.schema,
@@ -334,6 +330,9 @@ export default class SupabaseClient<
334330
(event === 'TOKEN_REFRESHED' || event === 'SIGNED_IN') &&
335331
this.changedAccessToken !== token
336332
) {
333+
// Token has changed
334+
this.realtime.setAuth(token ?? null)
335+
337336
this.changedAccessToken = token
338337
} else if (event === 'SIGNED_OUT') {
339338
// Token is removed

0 commit comments

Comments
 (0)