-
Notifications
You must be signed in to change notification settings - Fork 1.6k
auth.useUserAccessGroup(accessGroup) does not work to share authentication between Watch and iPhone #7854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @RohitRajendran, would you mind sharing a minimal repro that I can run locally? It would help us a lot digging into the cause of your issue. Thanks. |
Hey @RohitRajendran. 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! |
Since there haven't been any recent updates here, I am going to close this issue. @RohitRajendran if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this. |
Reopening based on conversation in #7840. Note that watchOS is community supported so it may be awhile before anyone gets to this. |
Thanks for re-opening, Paul. It would be good to have a "best practices for watchOS + iOS Firebase apps" doc that lives somewhere, even community-supported and with huge asterisks that it's not official yet. I think there are a few options:
The disadvantage of this approach is that it does not allow for a standalone watchOS app; the watch can only be used as a companion to the iOS app. In reality, very few apps are - or need to be - standalone; the watchOS App Store is a bit of a joke. So this should be fine for most developers.
I haven't gotten this approach working yet but in theory it could/should work and it enables a full "acts like a peer" approach for watchOS as a client that enables an independent watchOS app experience. The phone and watch don't need to be communicating directly for this to work either; e.g. if the watch has a cellular connection it should be able to complete the iCloud sync.
This has the advantage of allowing for a much simpler and smaller watchOS client - the client never makes any "network" requests at all, just chatting with the host iOS app. No Firebase on-watch! The iOS app can use more sophisticated protocols like gRPC to talk to server backends to fulfill the request, none of which the watchOS app needs to be worried about. And the iOS app can just re-use existing code paths already needed to implement these things. The disadvantage is that all operations must be done in actively paired mode; the watchOS app will stop working altogether without an active WCSession, so the watch can never be far from the phone. That's probably an acceptable tradeoff for most apps.
It should be made clear to developers that setting up an app group for their watchOS extension and iOS app and then asking Firebase Auth to use that app group will NOT magically allow Firebase Auth to work correctly on-watch because app groups are used for on-device sharing and the watch and phone are separate devices. Clearly spelling this out will save developers heartache trying to figure out what's wrong. |
@dweekly You are right, app group doesn't support data sharing between watch and iPhone. So unfortunately this issue is expected. We are looking at the possibilities of supporting this feature. In the meantime, @RohitRajendran and @dweekly It would be great to file a feature request and upvote the issue, which helps us prioritize. |
@RohitRajendran @dweekly Can you share a bit about your use case? Do you use other Firebase products on watch that need authentication or you want to only show user data when authentication is confirmed on watch? For the second case, you can use WatchConnectivity to notify you watch if user has authenticated on the iPhone. |
I'm trying to figure this out right now. |
This issue should be closed. The original usage of an app group (which is solely for exchanges among apps on one device) is the source of error. |
Uh oh!
There was an error while loading. Please reload this page.
[REQUIRED] Step 1: Describe your environment
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
I'm trying to use
Auth.auth().useUserAccessGroups
across both iPhone and WatchOS apps to share authentication. The iPhone app initiates an anonymous sign in and should be sharing the user but the watch app returns nil.signInAnonymously
after callingAuth.auth().useUserAccessGroup
Auth.auth().useUserAccessGroup
Relevant Code:
In iPhone app:
In watch app:
The text was updated successfully, but these errors were encountered: