Skip to content

Commit e456d00

Browse files
authored
[Auth] Fix tenantId field when setting user via updateCurrentUser (#5577)
* Fix tenantId field when setting user via updateCurrentUser * Add changeset
1 parent 3e920c8 commit e456d00

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.changeset/twelve-scissors-wink.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/auth": patch
3+
---
4+
5+
Fix bug where `user.tenantId` wasn't being carried over in `updateCurrentUser` function

packages/auth/src/core/user/user_impl.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ describe('core/user/user_impl', () => {
263263
phoneNumber: 'number',
264264
photoURL: 'photo',
265265
emailVerified: false,
266-
isAnonymous: true
266+
isAnonymous: true,
267+
tenantId: 'tenant-id'
267268
});
268269

269270
const newAuth = await testAuth();
@@ -272,6 +273,7 @@ describe('core/user/user_impl', () => {
272273
expect(copy.stsTokenManager).not.to.eq(user.stsTokenManager);
273274
expect(copy.toJSON()).to.eql(user.toJSON());
274275
expect(copy.auth).to.eq(newAuth);
276+
expect(copy.tenantId).to.eq('tenant-id');
275277
});
276278
});
277279
});

packages/auth/src/core/user/user_impl.ts

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export class UserImpl implements UserInternal {
8787
this.phoneNumber = opt.phoneNumber || null;
8888
this.photoURL = opt.photoURL || null;
8989
this.isAnonymous = opt.isAnonymous || false;
90+
this.tenantId = opt.tenantId || null;
9091
this.metadata = new UserMetadata(
9192
opt.createdAt || undefined,
9293
opt.lastLoginAt || undefined

0 commit comments

Comments
 (0)