Contents

getDefaultCredential(for:task:completionHandler:)

Gets the default credential for the specified protection space, which is being accessed by the given task, and passes it to the provided completion handler.

Declaration

func getDefaultCredential(for space: URLProtectionSpace, task: URLSessionTask, completionHandler: @escaping  @Sendable (URLCredential?) -> Void)
func defaultCredential(for space: URLProtectionSpace, task: URLSessionTask) async -> URLCredential?

Parameters

  • space:

    The protection space of interest.

  • task:

    The task seeking to use the protection space

  • completionHandler:

    A completion handler that receives the default credential as its argument, or nil if there is no default credential for this combination of protection space and task.

See Also

Getting and setting default credentials