File tree Expand file tree Collapse file tree 4 files changed +17
-0
lines changed
android/src/main/java/io/invertase/firebase/auth Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1970,6 +1970,7 @@ private WritableMap firebaseUserToMap(FirebaseUser user) {
19701970 final String provider = user .getProviderId ();
19711971 final boolean verified = user .isEmailVerified ();
19721972 final String phoneNumber = user .getPhoneNumber ();
1973+ final String tenantId = user .getTenantId ();
19731974
19741975 userMap .putString ("uid" , uid );
19751976 userMap .putString ("providerId" , provider );
@@ -2000,6 +2001,12 @@ private WritableMap firebaseUserToMap(FirebaseUser user) {
20002001 userMap .putNull ("phoneNumber" );
20012002 }
20022003
2004+ if (tenantId != null && !"" .equals (tenantId )) {
2005+ userMap .putString ("tenantId" , tenantId );
2006+ } else {
2007+ userMap .putNull ("tenantId" );
2008+ }
2009+
20032010 userMap .putArray ("providerData" , convertProviderData (user .getProviderData (), user ));
20042011
20052012 WritableMap metadataMap = Arguments .createMap ();
Original file line number Diff line number Diff line change @@ -1210,6 +1210,7 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
12101210 @" providerData" : [self convertProviderData: user.providerData],
12111211 keyProviderId: [user.providerID lowercaseString ],
12121212 @" refreshToken" : user.refreshToken ,
1213+ @" tenantId" : user.tenantID ? (id ) user.tenantID : [NSNull null ],
12131214 keyUid: user.uid
12141215 };
12151216}
Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ export default class User {
5252 return this . _user . phoneNumber || null ;
5353 }
5454
55+ get tenantId ( ) {
56+ return this . _user . tenantId || null ;
57+ }
58+
5559 get photoURL ( ) {
5660 return this . _user . photoURL || null ;
5761 }
Original file line number Diff line number Diff line change @@ -397,6 +397,10 @@ export namespace FirebaseAuthTypes {
397397 * Returns the unique identifier of the provider type that this instance corresponds to.
398398 */
399399 providerId : string ;
400+ /**
401+ * Returns a string representing the multi-tenant tenant id. This is null if the user is not associated with a tenant.
402+ */
403+ tenantId ?: string ;
400404 /**
401405 * Returns a user identifier as specified by the authentication provider.
402406 */
@@ -1247,6 +1251,7 @@ export namespace FirebaseAuthTypes {
12471251 * await firebase.auth().setTenantId('tenant-123');
12481252 * ```
12491253 *
1254+ * @error auth/invalid-tenant-id if the tenant id is invalid for some reason
12501255 * @param tenantId the tenantID current app bind to.
12511256 */
12521257 setTenantId ( tenantId : string ) : Promise < void > ;
You can’t perform that action at this time.
0 commit comments