diff --git a/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift b/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift index b0e9a93fca5..f84a87d3e07 100644 --- a/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift +++ b/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift @@ -109,7 +109,11 @@ class AuthBackend: NSObject { request.setValue(Bundle.main.bundleIdentifier, forHTTPHeaderField: "X-Ios-Bundle-Identifier") request.setValue(requestConfiguration.appID, forHTTPHeaderField: "X-Firebase-GMPID") if let heartbeatLogger = requestConfiguration.heartbeatLogger { - request.setValue(heartbeatLogger.headerValue(), forHTTPHeaderField: "X-Firebase-Client") + // The below call synchronously dispatches to a queue. To avoid blocking + // the shared concurrency queue, `async let` will spawn the process on + // a separate thread. + async let heartbeatsHeaderValue = heartbeatLogger.headerValue() + await request.setValue(heartbeatsHeaderValue, forHTTPHeaderField: "X-Firebase-Client") } request.httpMethod = requestConfiguration.httpMethod let preferredLocalizations = Bundle.main.preferredLocalizations