-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
[REQUIRED] Step 1: Describe your environment
- Xcode version: 13.2.1
- Firebase SDK version: 8.15.0 (commit b4dd98d)
- Installation method:
Swift Package Manager - Firebase Component: Auth
- Target platform(s):
iOS | watchOS
[REQUIRED] Step 2: Describe the problem
I'm having trouble sharing an authenticated user between an iOS and a watchOS app.
By creating a watchOS app for an iOS app, I expect to be able to share authentication between both - so, to sign a user in through the iOS app and be able to use it in the watchOS app.
I've tried two approaches:
1. Using the same GoogleService-Info.plist for both iOS and watchOS. This causes a warning because the bundle ID of the watch app doesn't match the one of the iOS app.
In this example, the bundle ID for my watch app was *app-bundle-id*.watchkitapp and *app-bundle-id*.watchkitapp.watchkitextension for the watch extension.
I thought this approach would work, since it's the same one I've successfully used previously with widgets, but no luck...
2. Using a separate GoogleService-Info.plist for the watchOS app. The bundle ID warning now disappears and the setup is successful.
However, when trying to call getStoredUser in the watch app (after logging in on the iOS app), the user returned is always nil.
Additionally, on both configurations I've setup Keychain sharing capabilities for both apps and am calling Auth.auth().useUserAccessGroup(...) after FirebaseApp.configure().
Here's a link to a sample project configured as described in approach #2.
Am I doing something wrong in terms of configuration?
Cheers!