google / GTMAppAuth

Apple platforms SDK for using AppAuth with Google libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keychain sharing not working with app extension

phil1995 opened this issue · comments

I am currently trying to access the last logged in user of the main app in an app extension. It seems that although keychain sharing is enabled in both and the main app and extension are in the same app group, the extension does not access the same keychain to restore the session.
I first found this out when I implemented the login via GoogleSignIn.
The function restorePrevoiusSignIn() works in the Main App as expected but not in the App Extension.
Now that I have checked the source code of GTMAppAuth, it seems that the AccessGroup is not defined anywhere (and if so, where can it be defined)?

@phil1995 Have you found any solution to the issue? I'm trying to access the authorisation from the Widget Extension as well and it always returns false.

GTMAppAuth stores auth state in the default keychain group. If you have the Keychain Sharing capability enabled and one or more keychain access groups defined, the default keychain group will be the first item in this list of keychain access groups. If your host app and app extension targets are both configured in this way, they should be able to share auth state.

https://developer.apple.com/documentation/security/keychain_services/keychain_items/sharing_access_to_keychain_items_among_a_collection_of_apps