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

Keychain sharing not working with app extension #95

Open
phil1995 opened this issue Feb 8, 2020 · 2 comments
Open

Keychain sharing not working with app extension #95

phil1995 opened this issue Feb 8, 2020 · 2 comments

Comments

@phil1995
Copy link

phil1995 commented Feb 8, 2020

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)?

@infinitetrooper
Copy link

@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.

@petea
Copy link
Contributor

petea commented Dec 15, 2021

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

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

No branches or pull requests

4 participants
@petea @infinitetrooper @phil1995 and others