Skip to content

Commit 7cbf046

Browse files
committed
Add explanatory comment to database
1 parent 8e58f85 commit 7cbf046

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/database/src/realtime/WebSocketConnection.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,16 @@ export class WebSocketConnection implements Transport {
166166
}
167167
};
168168

169-
// Adding a comment to ask questions
169+
// If using Node with admin creds, AppCheck-related checks are unnecessary.
170+
// It will send the authorization token.
170171
if (this.nodeAdmin) {
171172
options.headers['Authorization'] = this.authToken || '';
172173
} 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.
173179
options.headers['X-Firebase-AppCheck'] = this.appCheckToken || '';
174180
}
175181

0 commit comments

Comments
 (0)