Skip to content

[auth] Fix logic inconsistency between 10.x and 11.x #14067

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading