Skip to content

Commit

Permalink
Fix logic inconsistency between 10.x and 11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed Nov 8, 2024
1 parent 0aca0bf commit 8f0d9da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion FirebaseAuth/Sources/Swift/User/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1598,18 +1598,22 @@ extension User: NSSecureCoding {}
/// Retrieves the Firebase authentication token, possibly refreshing it if it has expired.
/// - Parameter forceRefresh
func internalGetTokenAsync(forceRefresh: Bool = false) async throws -> String {
var keychainError = false
do {
let (token, tokenUpdated) = try await tokenService.fetchAccessToken(
forcingRefresh: forceRefresh
)
if tokenUpdated {
if let error = updateKeychain() {
keychainError = true
throw error
}
}
return token!
} catch {
signOutIfTokenIsInvalid(withError: error)
if !keychainError {
signOutIfTokenIsInvalid(withError: error)
}
throw error
}
}
Expand Down

0 comments on commit 8f0d9da

Please sign in to comment.