Skip to content
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

[Auth] Add app ID prefix to sample plist #13599

Merged
merged 1 commit into from
Sep 6, 2024
Merged

[Auth] Add app ID prefix to sample plist #13599

merged 1 commit into from
Sep 6, 2024

Conversation

ncooke3
Copy link
Member

@ncooke3 ncooke3 commented Sep 6, 2024

+++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/SwiftApplication.plist
@@ -2,6 +2,8 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+       <key>AppIdentifierPrefix</key>
+       <string>$(AppIdentifierPrefix)</string>

Will enable you to easily test keychain groups without further configuring the sample app. This should dynamically evaluate to TEAMID.com.google.firebase.auth.keychainGroup1, but I did notice very sneaky behavior where the cert's team ID is not used as the app ID prefix for simulator builds. This caused the missing entitlements -34018 error when testing because kecyhain group I was looking for was not the same as the keychain group the app had provisioned on simulator. Using the $(AppIdentifierPrefix) variable as opposed to hardcoding something will ensure it's always what Xcode is looking for.

private func toggleAccessGroup() {
if AppManager.shared.auth().userAccessGroup == nil {
guard let bundleDictionary = Bundle.main.infoDictionary,
let group = bundleDictionary["AppIdentifierPrefix"] as? String else {
fatalError("Configure AppIdentifierPrefix in the plist")
}
AppManager.shared.auth().userAccessGroup = group + "com.google.firebase.auth.keychainGroup1"
} else {
AppManager.shared.auth().userAccessGroup = nil
}
}

#no-changelog

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants