download(_:didReceive:completionHandler:)
Asks the delegate to respond to an authentication challenge.
Declaration
optional func download(_ download: WKDownload, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping @MainActor @Sendable (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)optional func download(_ download: WKDownload, respondTo challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?)Parameters
- download:
The download that received the authentication challenge.
- challenge:
The authentication challenge.
- completionHandler:
A closure you must invoke to respond to the authentication challenge. Provide the closure with a disposition that describes how to respond to the authorization challenge, and optional credentials.
Discussion
Determine how to respond to the authentication challenge in this method. Then invoke completionHandler with a disposition that describes how to respond to the authorization challenge, and optional credentials.
If you don’t implement this method, the web view responds to the challenge with URLSession.AuthChallengeDisposition.rejectProtectionSpace.