SSO for Excel custom functions
Use case: We have a task pane Excel Add-in working in conjunction with custom functions. Custom functions as well as the task pane need authentication before they are granted access to a resource. We'd like to offer either Single-Sign-On with the Microsoft account or sign-on with a proprietary account and want to avoid burdening the user with multiple sign-in prompts. The custom functions don't need any UI, that means the user can run custom functions with or without opening the task pane.
I'm aware of the 'OfficeRuntime.AsyncStorage' option to exchange tokens between the task pane and the custom function portions.
Custom functions may open a OfficeRuntime dialog to prompt the user for credentials, at least for the proprietary account, and acquired access tokens can be stored into the AsyncStorage from where the task pane can pick it up so that the user is not prompted again (or the other way around).
AFAIK, custom functions cannot use SSO in any dialog since there is no access to 'Office.context.auth.getAccessTokenAsync'. As a work-around the user could be asked to open the task pane and obtain an SSO token there from where it can then be passed back to the custom function via the AsyncStore. It would mean though that the custom function authentication logic would need to poll AsyncStore to detect any new token placed there as there is no notification or callback for AsyncStore changes.
Is there an easy/recommended way to enable SSO for custom functions? Could 'getAccessTokenAsync' be made available for custom functions?