@@ -167,16 +167,15 @@ export class WebSocketConnection implements Transport {
167
167
} ;
168
168
169
169
// If using Node with admin creds, AppCheck-related checks are unnecessary.
170
- // It will send the authorization token.
171
- if ( this . nodeAdmin ) {
172
- options . headers [ 'Authorization' ] = this . authToken || '' ;
173
- } else {
174
- // If using Node without admin creds (which includes all uses of the
175
- // client-side Node SDK), it will send an AppCheck token if available.
176
- // Any other auth credentials will eventually be sent after the connection
177
- // is established, but aren't needed here as they don't effect the initial
178
- // request to establish a connection.
179
- options . headers [ 'X-Firebase-AppCheck' ] = this . appCheckToken || '' ;
170
+ // Note that we send the credentials here even if they aren't admin credentials, which is
171
+ // not a problem.
172
+ // Note that this header is just used to bypass appcheck, and the token should still be sent
173
+ // through the websocket connection once it is established.
174
+ if ( this . authToken ) {
175
+ options . headers [ 'Authorization' ] = this . authToken ;
176
+ }
177
+ if ( this . appCheckToken ) {
178
+ options . headers [ 'X-Firebase-AppCheck' ] = this . appCheckToken ;
180
179
}
181
180
182
181
// Plumb appropriate http_proxy environment variable into faye-websocket if it exists.
@@ -239,7 +238,7 @@ export class WebSocketConnection implements Transport {
239
238
/**
240
239
* No-op for websockets, we don't need to do anything once the connection is confirmed as open
241
240
*/
242
- start ( ) { }
241
+ start ( ) { }
243
242
244
243
static forceDisallow_ : boolean ;
245
244
0 commit comments