Skip to content
Closed
Show file tree
Hide file tree
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
120 changes: 86 additions & 34 deletions FirebaseAuth/Sources/Swift/Auth/Auth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import FirebaseAuthInterop
import FirebaseCore
import FirebaseCoreExtension
import FirebaseCoreInternal
#if COCOAPODS
internal import GoogleUtilities
#else
Expand Down Expand Up @@ -83,48 +84,75 @@
public func getToken(forcingRefresh forceRefresh: Bool,
completion callback: @escaping (String?, Error?) -> Void) {
kAuthGlobalWorkQueue.async { [weak self] in
if let strongSelf = self {
// Enable token auto-refresh if not already enabled.
if !strongSelf.autoRefreshTokens {
AuthLog.logInfo(code: "I-AUT000002", message: "Token auto-refresh enabled.")
strongSelf.autoRefreshTokens = true
strongSelf.scheduleAutoTokenRefresh()

#if os(iOS) || os(tvOS) // TODO(ObjC): Is a similar mechanism needed on macOS?
strongSelf.applicationDidBecomeActiveObserver =
NotificationCenter.default.addObserver(
forName: UIApplication.didBecomeActiveNotification,
object: nil, queue: nil
) { notification in
if let strongSelf = self {
strongSelf.isAppInBackground = false
if !strongSelf.autoRefreshScheduled {
strongSelf.scheduleAutoTokenRefresh()
}
}
}
strongSelf.applicationDidEnterBackgroundObserver =
NotificationCenter.default.addObserver(
forName: UIApplication.didEnterBackgroundNotification,
object: nil, queue: nil
) { notification in
if let strongSelf = self {
strongSelf.isAppInBackground = true
}
}
#endif
guard let self = self else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
guard let self = self else {
guard let self else {

DispatchQueue.main.async { callback(nil, nil) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using any of the Auth.wrapMainAsync APIs work here?

return
}
/// Before checking for a standard user, check if we are in a token-only session established
/// by a successful exchangeToken call.
let rGCIPToken = self.rGCIPFirebaseTokenLock.withLock { $0 }

if let token = rGCIPToken {
/// Logic for tokens obtained via exchangeToken (R-GCIP mode)
if token.expirationDate < Date() {
/// Token expired
let error = AuthErrorUtils
.userTokenExpiredError(
message: "The firebase access token obtained via exchangeToken() has expired."
)
Auth.wrapMainAsync(callback: callback, with: .failure(error))
} else if forceRefresh {
/// Token is not expired, but forceRefresh was requested which is currently unsupported
let error = AuthErrorUtils
.operationNotAllowedError(
message: "forceRefresh is not supported for firebase access tokens obtained via exchangeToken()."
)
Auth.wrapMainAsync(callback: callback, with: .failure(error))
} else {
/// The token is valid and not expired.
Auth.wrapMainAsync(callback: callback, with: .success(token.token))
}
/// Exit here as this path is for rGCIPFirebaseToken only.
return
}
// Call back with 'nil' if there is no current user.
guard let strongSelf = self, let currentUser = strongSelf._currentUser else {
/// Fallback to standard `currentUser` logic if not in token-only mode.
/// ... (rest of the original function)
if !self.autoRefreshTokens {
AuthLog.logInfo(code: "I-AUT000002", message: "Token auto-refresh enabled.")
self.autoRefreshTokens = true
self.scheduleAutoTokenRefresh()

#if os(iOS) || os(tvOS)
self.applicationDidBecomeActiveObserver =
NotificationCenter.default.addObserver(
forName: UIApplication.didBecomeActiveNotification,
object: nil,
queue: nil
) { [weak self] _ in
guard let self = self, !self.isAppInBackground,
!self.autoRefreshScheduled else { return }
self.scheduleAutoTokenRefresh()
}
self.applicationDidEnterBackgroundObserver =
NotificationCenter.default.addObserver(
forName: UIApplication.didEnterBackgroundNotification,
object: nil,
queue: nil
) { [weak self] _ in
self?.isAppInBackground = true
}
#endif
}

guard let currentUser = self._currentUser else {
DispatchQueue.main.async {
callback(nil, nil)
}
return
}
// Call back with current user token.
currentUser
.internalGetToken(forceRefresh: forceRefresh, backend: strongSelf.backend) { token, error in
.internalGetToken(forceRefresh: forceRefresh, backend: self.backend) { token, error in
DispatchQueue.main.async {
callback(token, error)
}
Expand Down Expand Up @@ -2265,6 +2293,12 @@
return { result in
switch result {
case let .success(authResult):
/// When a standard user successfully signs in, any existing token-only session must be
/// invalidated to prevent a conflicting auth state.
/// Clear any R-GCIP session state when a standard user signs in. This ensures we exit
/// Token-Only Mode.
self.rGCIPFirebaseTokenLock.withLock { $0 = nil }
/// ... rest of original function
do {
try self.updateCurrentUser(authResult.user, byForce: false, savingToDisk: true)
Auth.wrapMainAsync(callback: callback, with: .success(authResult))
Expand Down Expand Up @@ -2428,9 +2462,20 @@
///
/// Mutations should occur within a @synchronized(self) context.
private var listenerHandles: NSMutableArray = []

// R-GCIP Token-Only Session State

/// The session token obtained from a successful `exchangeToken` call, protected by a lock.
///
/// This property is used to support a "token-only" authentication mode for Regionalized
/// GCIP, where no `User` object is created. It is mutually exclusive with `_currentUser`.
/// If the wrapped value is non-nil, the `AuthInterop` layer will use it for token generation
/// instead of relying on a `currentUser`.
private var rGCIPFirebaseTokenLock = FIRAllocatedUnfairLock<FirebaseToken?>(initialState: nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIRAllocatedUnfairLock is a class. It's instances should be a constant.

Suggested change
private var rGCIPFirebaseTokenLock = FIRAllocatedUnfairLock<FirebaseToken?>(initialState: nil)
private let rGCIPFirebaseTokenLock = FIRAllocatedUnfairLock<FirebaseToken?>(initialState: nil)

}

/// Regionalized auth
// MARK: Regionalized auth
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not: the added dash adds a horizontal line divider in Xcode

Suggested change
// MARK: Regionalized auth
// MARK: - Regionalized auth


@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
public extension Auth {
/// Gets the Auth object for a `FirebaseApp` configured for a specific Regional Google Cloud
Expand Down Expand Up @@ -2515,6 +2560,13 @@
token: response.firebaseToken,
expirationDate: response.expirationDate
)
rGCIPFirebaseTokenLock.withLock { token in
if self._currentUser != nil {
try? self.signOut()
}
token = firebaseToken

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope

Check failure on line 2567 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope
}
return firebaseToken

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / storage-combine-integration

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope

Check failure on line 2569 in FirebaseAuth/Sources/Swift/Auth/Auth.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

cannot find 'firebaseToken' in scope
} catch {
throw error
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ struct ExchangeTokenResponse: AuthRPCResponse {
///
/// - Parameter dictionary: The dictionary representing the JSON response from server.
/// - Throws: `AuthErrorUtils.unexpectedResponse` if the required fields
/// (like "idToken", "expiresIn") are missing, have unexpected types
/// (like "accessToken", "expiresIn") are missing or have unexpected types.
init(dictionary: [String: AnyHashable]) throws {
guard let token = dictionary["idToken"] as? String else {
guard let token = dictionary["accessToken"] as? String else {
throw AuthErrorUtils.unexpectedResponse(deserializedResponse: dictionary)
}
firebaseToken = token
Expand Down
Loading