Skip to content

Commit 3d13f56

Browse files
committed
Pass auth token to the connection, and use Bearer in the header value
1 parent aeab9ce commit 3d13f56

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/database/src/realtime/Connection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export class Connection {
122122
this.repoInfo_,
123123
this.applicationId_,
124124
this.appCheckToken_,
125+
this.authToken_,
125126
this.lastSessionId
126127
);
127128

packages/database/src/realtime/WebSocketConnection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class WebSocketConnection implements Transport {
172172
// Note that this header is just used to bypass appcheck, and the token should still be sent
173173
// through the websocket connection once it is established.
174174
if (this.authToken) {
175-
options.headers['Authorization'] = this.authToken;
175+
options.headers['Authorization'] = `Bearer ${this.authToken}`;
176176
}
177177
if (this.appCheckToken) {
178178
options.headers['X-Firebase-AppCheck'] = this.appCheckToken;
@@ -238,7 +238,7 @@ export class WebSocketConnection implements Transport {
238238
/**
239239
* No-op for websockets, we don't need to do anything once the connection is confirmed as open
240240
*/
241-
start() { }
241+
start() {}
242242

243243
static forceDisallow_: boolean;
244244

0 commit comments

Comments
 (0)