Skip to content

Commit d1b950f

Browse files
authored
Fix user session persistence in multi tenant projects (#13567)
1 parent 7700b58 commit d1b950f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

FirebaseAuth/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
- [Fixed] Fixed crashes that could occur in Swift continuation blocks running in the Xcode 16
33
betas. (#13480)
44
- [Fixed] Fixed Phone Auth via Sandbox APNS tokens that broke in 11.0.0. (#13479)
5-
- [Fixed] Fix crash when fetching sign in methods due to unexpected nil.
5+
- [Fixed] Fixed crash when fetching sign in methods due to unexpected nil.
66
Previously, fetching sign in methods could return both a `nil` array of sign
77
in methods and a `nil` error. In such cases, an empty array is instead
88
returned with the `nil` error. (#13550)
9-
9+
- [Fixed] Fixed user session persistence in multi tenant projects. Introduced in 11.0.0. (#13565)
1010

1111
# 11.1.0
1212
- [fixed] Fixed `Swift.error` conformance for `AuthErrorCode`. (#13430)

FirebaseAuth/Sources/Swift/Auth/Auth.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,9 +1667,11 @@ extension Auth: AuthInterop {
16671667
try self.internalUseUserAccessGroup(storedUserAccessGroup)
16681668
} else {
16691669
let user = try self.getUser()
1670-
try self.updateCurrentUser(user, byForce: false, savingToDisk: false)
16711670
if let user {
16721671
self.tenantID = user.tenantID
1672+
}
1673+
try self.updateCurrentUser(user, byForce: false, savingToDisk: false)
1674+
if let user {
16731675
self.lastNotifiedUserToken = user.rawAccessToken()
16741676
}
16751677
}
@@ -1941,8 +1943,7 @@ extension Auth: AuthInterop {
19411943
}
19421944
if let user {
19431945
if user.tenantID != nil || tenantID != nil, tenantID != user.tenantID {
1944-
let error = AuthErrorUtils.tenantIDMismatchError()
1945-
throw error
1946+
throw AuthErrorUtils.tenantIDMismatchError()
19461947
}
19471948
}
19481949
var throwError: Error?

FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,7 @@ private class AuthBackendRPCImplementation: NSObject, AuthBackendImplementation
484484
code: AuthErrorCode.maximumSecondFactorCountExceeded,
485485
message: serverDetailErrorMessage
486486
)
487-
case "TENANT_ID_MISMATCH": return AuthErrorUtils
488-
.tenantIDMismatchError()
487+
case "TENANT_ID_MISMATCH": return AuthErrorUtils.tenantIDMismatchError()
489488
case "TOKEN_EXPIRED": return AuthErrorUtils
490489
.userTokenExpiredError(message: serverDetailErrorMessage)
491490
case "UNSUPPORTED_FIRST_FACTOR": return AuthErrorUtils

0 commit comments

Comments
 (0)