Skip to content

Commit 16b343a

Browse files
committed
First Party Auth Factory
1 parent 54ce678 commit 16b343a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/firestore/src/api/credentials.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ interface Gapi {
398398
export class FirstPartyToken implements Token {
399399
type = 'FirstParty' as TokenType;
400400
user = User.FIRST_PARTY;
401-
headers = new Map();
401+
private _headers = new Map();
402402

403403
constructor(
404404
private readonly gapi: Gapi,
@@ -426,18 +426,18 @@ export class FirstPartyToken implements Token {
426426
}
427427
}
428428

429-
get authHeaders(): { [header: string]: string } {
430-
const headers: { [header: string]: string } = {
431-
'X-Goog-AuthUser': this.sessionIndex
432-
};
429+
get headers(): Map<string, string> {
430+
this._headers.set('X-Goog-AuthUser', this.sessionIndex);
433431
// Use array notation to prevent minification
434432
const authHeaderTokenValue = this.getAuthToken();
435433
if (authHeaderTokenValue) {
436-
headers['Authorization'] = authHeaderTokenValue;
434+
this._headers.set('Authorization', authHeaderTokenValue);
437435
}
438-
if (iamToken) {
439-
this.headers.set('X-Goog-Iam-Authorization-Token', iamToken);
436+
if (this.iamToken) {
437+
this._headers.set('X-Goog-Iam-Authorization-Token', this.iamToken);
440438
}
439+
440+
return this._headers;
441441
}
442442
}
443443

0 commit comments

Comments
 (0)