firebase-ios-sdk
firebase-ios-sdk copied to clipboard
Unreliable Auth state shared with app extension using same access group
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(<myKeychainAccessGroup>)
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.
Would you mind sharing a minimal repro with a main app and sharing extension? That would help us a lot digging into it.
Hey @cybergen78. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
It's a commercial product. I'll have to ask my employer if I may spend time on it. I'll get back soon, here.
I might be able to create a sample project in the week after next week. I'll keep you updated.
Hi @cybergen78, I just want to check if you're still encountering the issue. If so, please provide a sample project (MCVE) that will reproduce the issue so we could take a look what's causing it. Thanks.
I didn't have time for this project since then. But I should have some time in the next 3 weeks. Sorry for the delay.
Eventually, I got the time to create an MCVE. I could reproduce the issue with this example project but it's even worse. In StarSnoopy at least the user is still logged out from the share extension if he/she logs out in the app itself. In the example app this doesn't work neither. However, I can't figure out the difference - the relevant code and configuration is the same.
Thank you for creating the MCVE. I've filed an internal issue b/188421106 to track this.
Any progress on that?
I am facing the same issue. Seems like the currentUser
is being loaded the first time share extension context is being made and won't change unless you re-open the host app. It's weird. Dismissing the extension either by cancelling or completing won't affect the outcome.
Any updates here?