Skip to content

Fix more issues related to admin auth and appcheck. #5146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wet-pets-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/database': patch
---

Fix sending of auth tokens on node.
2 changes: 2 additions & 0 deletions packages/database/src/realtime/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export class Connection {
this.repoInfo_,
this.applicationId_,
this.appCheckToken_,
this.authToken_,
null,
this.lastSessionId
);

Expand Down
4 changes: 2 additions & 2 deletions packages/database/src/realtime/WebSocketConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class WebSocketConnection implements Transport {
// Note that this header is just used to bypass appcheck, and the token should still be sent
// through the websocket connection once it is established.
if (this.authToken) {
options.headers['Authorization'] = this.authToken;
options.headers['Authorization'] = `Bearer ${this.authToken}`;
}
if (this.appCheckToken) {
options.headers['X-Firebase-AppCheck'] = this.appCheckToken;
Expand Down Expand Up @@ -238,7 +238,7 @@ export class WebSocketConnection implements Transport {
/**
* No-op for websockets, we don't need to do anything once the connection is confirmed as open
*/
start() { }
start() {}

static forceDisallow_: boolean;

Expand Down