WidgetKit and Authentication

Hi,

How do I authenticate a user in a widget, indirectly?

Per Human Guidelines' :

Let people know when authentication adds value

Once the user has logged in using the app, how do I pass the logged-in/authenticated info the widget?

Thanks,
  • hoan


Answered by Frameworks Engineer in 616517022
Is this authenticated status for system capabilities (like photo access, etc.) or your app's login statuses?

If it's for system capabilities, you don't need to pass anything to the widget. Just checking the auth status in the widget is enough.

If it's your app's specific status, then you should use App Groups to share data between your host app and extensions. For an example you can check out the Soup Chef demo app: https://developer.apple.com/documentation/sirikit/soup_chef_accelerating_app_interactions_with_shortcuts
Accepted Answer
Is this authenticated status for system capabilities (like photo access, etc.) or your app's login statuses?

If it's for system capabilities, you don't need to pass anything to the widget. Just checking the auth status in the widget is enough.

If it's your app's specific status, then you should use App Groups to share data between your host app and extensions. For an example you can check out the Soup Chef demo app: https://developer.apple.com/documentation/sirikit/soup_chef_accelerating_app_interactions_with_shortcuts
I’m having problem too where app group is not working for me to access keychain data from widget extension but from other extension it works fine, I confirmed all app group setting which is correct
WidgetKit and Authentication
 
 
Q