Inside my app the user can sign in with Apple, Google, Facebook and Email using Firebase
. I also have a Share Extension
and I would like to share the auth-state
from the Main-App so I can also call Auth.auth.currentUser
inside my ShareExtension
so the user can access Cloud-Firestore
.
Now I know there is this documentation provided by Firebase. However I am not sure about Step 2:
do {
try Auth.auth().useUserAccessGroup("TEAMID.com.example.group1")
} catch let error as NSError {
print("Error changing user access group: %@", error)
}
Where exactly do I have to call this?
Edit:
Main App:
Update:
It is throwing this error
when calling the code above before signIn
:
Error changing user access group: %@ Error Domain=FIRAuthErrorDomain Code=17995 "An error occurred when accessing the keychain. The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo dictionary will contain more information about the error encountered" UserInfo={FIRAuthErrorUserInfoNameKey=ERROR_KEYCHAIN_ERROR, NSLocalizedFailureReason=SecItemCopyMatching (-34018), NSLocalizedDescription=An error occurred when accessing the keychain. The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo dictionary will contain more information about the error encountered}
didFinishLaunchingWithOptions
(and similar methods in extensions) I guess. Just afterFirebaseApp.configure()
– Dima Rostopiralet userID = Auth.auth().currentUser!.uid
inside myShare Extension
it is alwaysnil
... – Chris