Skip to content

Commit cc2cfd6

Browse files
committed
Add comment to README
1 parent d1a3fa6 commit cc2cfd6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,30 @@ let signInButton = GoogleSignInButton {
107107
}
108108
let hostedButton = NSHostingView(rootView: signInButton)
109109
```
110+
111+
## A Note iOS Keychain Access Groups
112+
113+
On iOS, if you do not supply a custom Keychain access group, the system creates
114+
a Keychain access group by prepending `$(AppIdentifierPrefix)` to your bundle
115+
ID (e.g., `$(AppIdentifierPrefix).com.example.MyApp`), which becomes the
116+
default access group for just your app ([Apple documentation](https://developer.apple.com/documentation/security/sharing-access-to-keychain-items-among-a-collection-of-apps#Establish-your-apps-private-access-group)).
117+
118+
If, however, you add a new Keychain access group (and add the entitlement to
119+
your app), then Xcode will use whatever access group is listed first in the
120+
list as the default. So, if the shared access group is first, then it becomes
121+
the default Keychain for your app.
122+
123+
The implication of this scenario is that credentials saved by GSI (via
124+
[GTMAppAuth](https://github.com/google/GTMAppAuth)) on behalf of your app will
125+
be stored in the shared keychain access group.
126+
127+
You should make sure that you want this behavior because GSI [removes Keychain
128+
items upon fresh install](https://github.com/google/GoogleSignIn-iOS/pull/567)
129+
to ensure that stale credentials from previous installs of your app are not
130+
mistakenly used. This behavior can lead new installs of apps sharing the same
131+
Keychain access group to remove Keychain credentials for apps already installed.
132+
133+
You can mitigate this by explicitly listing the typical default access group
134+
(or whatever you prefer) in your list first. GSI, via GTMAppAuth, will then use
135+
that default access group. Make sure that you also update your code that writes
136+
to the Keychain to explicitly use the shared access group as needed.

0 commit comments

Comments
 (0)