Post

Replies

Boosts

Views

Activity

ASAuthorization SSO Extension view controller for macOS
Our app is currently employing an SSO extension. Our implementation of beginAuthorization(with request: ASAuthorizationProviderExtensionAuthorizationRequest) seems to be working correctly, as we are able to process the request and complete the SSO. Unfortunately we seem to be running into trouble getting an associated UI to display for our users. Our info.plist file for the extension has the value NSExtensionPrincipalClass:$(PRODUCT_MODULE_NAME).AuthenticationViewController and we have an accompanying storyboard file named AuthenticationViewController.xib where the file's owner is set to our custom view controller. We have added a window and some views to this storyboard file and linked them to our view controller which is also named AuthenticationViewController The window will appear when the extension is activated. However, this window will appear behind the safari window we have open, and we cannot seem to bring it to the front of the other views. Traditional methods do not seem to work since the extension cannot access a sharedApplication object. We have tried other methods, including using NSRunningApplication.runningApplications to locate the extension via bundle identifier and activate it, but activation still does not bring it to the front of all open windows. We also tried using presentAuthorizationViewController(completion: @escaping (Bool, Error?) -> Void) to no avail. We got true for our result in the completion closure, but we couldn't get the UI to display at all in that case. We fear that we may be misguided in our approach, and have not configured our storyboard correctly to achieve the desired result. We have been able to find no example of this for macOS so any help would be greatly appreciated!
3
0
1.7k
Jul ’21