Skip to content

Commit

Permalink
[auth] Fix logic inconsistency between 10.x and 11.x (#14067)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Nov 11, 2024
1 parent a24e57c commit ec108bb
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 ec108bb

Please sign in to comment.