firebase / firebase/firebase-ios-sdk

Unreliable Auth state shared with app extension using same access group

Open
#6,997 12 comments 0 reactions 1 assignee Assigned to @rosalyntan View on GitHub
api: auth extensions internal-bug-filed
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 14h
Merged PRs (30d)
72

Description

### Environment
* Xcode version: 12.2
* Firebase SDK version: 7.1.0
* Installation method: `CocoaPods`
* Firebase Component: Auth

### Description
After logging out and in again in the main app, `AuthStateDidChangeListener` reports no logged in user in the app extension until the calling app is restarted.

#### Steps to reproduce:
Assume we have a main app and a share extension. The share extension can be called from other apps (e.g. Amazon, Safari).
Implement cross-app authentication with shared iOS Keychain as described here: https://firebase.google.com/docs/auth/ios/single-sign-on
The share extension calls `Auth.auth().useUserAccessGroup()` like the main app does too and listens for the auth state with a `AuthStateDidChangeListener`.
* Log in in the main app
* Check user is also logged in in the share extension (e.g. by sharing a website from Safari)
* Log out in the main app
* Check user is also logged out in the share extension
* Log in in the main app again
* Check user is also logged in again in the share extension

##### After these steps:
Expected: User is also logged in again in the share extension
Observed: User is not logged in in the share extension (user is `nil` in share extensions `AuthStateDidChangeListener`)

##### Weird solution:
Restarting the sharing/calling app (e.g. Safari) resolves the issue and the user is logged in again in the share extension despite the main app wasn't active in the meantime.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.