I have a similar question. I have an app that implements the extension but I can't get it to actually add a header to an HTTP request. I'm assuming if I go to the url listed in the MDM profile it will add the header, but I'm not seeing that.
import UIKit
import AuthenticationServices
class AuthenticationViewController: UIViewController {
var authorizationRequest: ASAuthorizationProviderExtensionAuthorizationRequest?
override func loadView() {
super.loadView()
// Do any additional setup after loading the view.
}
override var nibName: String? {
return "AuthenticationViewController"
}
}
extension AuthenticationViewController: ASAuthorizationProviderExtensionAuthorizationRequestHandler {
public func beginAuthorization(with request: ASAuthorizationProviderExtensionAuthorizationRequest) {
self.authorizationRequest = request
// Call this to indicate immediate authorization succeeded.
let authorizationHeaders: [String: String] = ["Authorization" : "API mytoken"] // TODO: Fill in appropriate authorization headers.
request.complete(httpAuthorizationHeaders: authorizationHeaders)
// Or present authorization view and call self.authorizationRequest.complete() later after handling interactive authorization.
// request.presentAuthorizationViewController(completion: { (success, error) in
// if error != nil {
// request.complete(error: error!)
// }
// })
}
}
mdm profile looks like:
ExtensionIdentifier
com.example.Example-Authenticator.Example-SSO
PayloadDescription
Configures Single Sign-On Extensions
PayloadDisplayName
Single Sign-On Extensions
PayloadIdentifier
com.apple.extensiblesso.F161FF82-39EB-41F8-9964-CF0EA36AEBBA
PayloadType
com.apple.extensiblesso
PayloadUUID
F161FF82-39EB-41F8-9964-CF0EA36AEBBA
PayloadVersion
1
Type
Redirect
URLs
https://company.example.com
I was expecting if I just go to https://company.example.com in safari I would see the header. It's a debug build of the app.