firebase-ios-sdk
firebase-ios-sdk copied to clipboard
[11.3.0] Auth: macOS not working "required entitlement" error
Description
There is an issue with Firebase Auth with macOS.
By default, on a brand new project, running this code:
func signIn(email: String, password: String) {
print("Signin \(email)")
Auth.auth().signIn(withEmail: email, password: password) { result, error in
print("Result signin \(result), error \(error?.localizedDescription ?? "")")
if let error = error {
print((error as NSError).userInfo)
}
}
}
Will result with the following error (if the credentials are correct) :
Result signin nil, error An error occurred when accessing the keychain. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo dictionary will contain more information about the error encountered ["NSLocalizedDescription": "An error occurred when accessing the keychain. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo dictionary will contain more information about the error encountered", "FIRAuthErrorUserInfoNameKey": "ERROR_KEYCHAIN_ERROR", "NSLocalizedFailureReason": "SecItemAdd (-34018) A required entitlement isn\'t present."]
Adding the Keychain sharing capability with a group and running the code again, will result in the signIn completion handler never get called.
The same code is working as expected in IOS simulator.
Reproducing the issue
No response
Firebase SDK Version
11.3
Xcode Version
16.0
Installation Method
Swift Package Manager
Firebase Product(s)
Authentication
Targeted Platforms
iOS, macOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Yes! I had this issue too but adding Keychain Sharing Capability fixed it.
Hi guys. Any update regarding these issue. Is there any way we can display more debug from Firebase to understand the issue?
After more testing, it appears that adding the Keychain Sharing with the app itself fix the issue. Maybe it should be worth mentioning in the docs?
Hi @Vincz, it is mentioned on the FAQ page: https://firebase.google.com/docs/ios/troubleshooting-faq#macos-keychain-sharing but I agree it could be more helpful to mention it elsewhere as well. Which docs were you looking at? Also, was this a new app or was the issue encountered when upgrading an existing app?
Hi @ncooke3! I was looking at these https://firebase.google.com/docs/auth/ios/start
It was during the creation of a new app but I also realized that an old app that uses to work before wasn't working anymore (maybe since the migration to Sequoia, but I'm not sure).
Anyway, it could be a good idea to add a mention about that in the Get started section, cause honestly, I never came across the page you mentioned while searching for my issue.
I've since updated those docs to call this out:
I'm going to mark this issue as closed now. Don't hesitate to reach out if you run into any more issues. Thanks!