Skip to content

Commit

Permalink
fix: Don't send access token in rest broadcast (#881)
Browse files Browse the repository at this point in the history
* fix: don't send access token in rest broadcast

* test: add apikey header
  • Loading branch information
Vinzent03 committed Apr 3, 2024
1 parent a636131 commit 01a10c9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions packages/realtime_client/lib/src/realtime_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,7 @@ class RealtimeChannel {
}

if (!canPush && type == RealtimeListenTypes.broadcast) {
final headers = {
'Content-Type': 'application/json',
'apikey': socket.accessToken ?? '',
...socket.headers
};
final headers = {'Content-Type': 'application/json', ...socket.headers};
final body = {
'messages': [
{
Expand Down
1 change: 1 addition & 0 deletions packages/realtime_client/test/channel_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ void main() {
mockServer = await HttpServer.bind('localhost', 0);
socket = RealtimeClient(
'ws://${mockServer.address.host}:${mockServer.port}/realtime/v1',
headers: {'apikey': 'supabaseKey'},
params: {'apikey': 'supabaseKey'},
);

Expand Down
2 changes: 1 addition & 1 deletion packages/supabase/lib/src/supabase_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class SupabaseClient {
params: {
'apikey': _supabaseKey,
},
headers: headers,
headers: {'apikey': _supabaseKey, ...headers},
logLevel: options.logLevel,
httpClient: _authHttpClient,
);
Expand Down

0 comments on commit 01a10c9

Please sign in to comment.