How to handle FileProvider notAuthenticated error in macOS?

I am running a similar code in FileProvider extension, which throws an notAuthenticated error if the user is not logged in. How do I make user to launch the parent app for the authentication?

func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) {

 if(isSignedOut){
            observer.finishEnumeratingWithError(NSFileProviderError(.notAuthenticated))
            return
        }
}

And in the Finder it shows

The right corner has Sign in button how do get action control of that button?

You should implement the FileProviderUI extension point. This will allow you to present UI when the Sign In button is pressed. It is a separate extension point from FileProvider.

See this documentation for the not authenticated error specifically: https://developer.apple.com/documentation/fileproviderui/fpuiactionextensionviewcontroller/2919962-prepareforerror?language=objc

The FruitBasket sample code also has implemented this authentication flow. You can download that here: https://developer.apple.com/documentation/fileprovider/replicated_file_provider_extension/synchronizing_files_using_file_provider_extensions?language=objc

How to handle FileProvider notAuthenticated error in macOS?
 
 
Q