That is, what is an idiomatic way to do this that is prescribed by Apple? For any suggestion, please explain HOW that should be done and/or provide a link to official guides. This should be a common enough scenario, but I was only able to find workarounds.
Approaching this from the other end, I know that UserDefaults(suiteName:)
and Keychain services
can be used from the containing app to share information about the authenticated user with the extension, but what if the user installs the app and just jumps right into trying to share content using its extension without ever signing in (or up)?
Ask user to sign in in the containing app? (In a custom view? Extensions are modal by default.)
Re-implement authentication in extension? (Or shared via custom framework? Is this possible?)
Switch to containing app and then back? This doesn't seem to be supported except in Today extension, but the mechanism described in the docs have been used for workarounds (SO threads: 1, 2, 3).
An (ugly) sample implementation of item 2 in this answer using Firebase.