<!--
{
  "documentType" : "article",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/nsurlprotectionspace-authentication-method-constants",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "NSURLProtectionSpace authentication method constants"
}
-->

# NSURLProtectionSpace authentication method constants

Constants describing known values of the [`authenticationMethod`](/documentation/Foundation/URLProtectionSpace/authenticationMethod) property of a [`URLProtectionSpace`](/documentation/Foundation/URLProtectionSpace).

## Discussion

These constants are also used with the [`URLProtectionSpace`](/documentation/Foundation/URLProtectionSpace) initializers [`init(host:port:protocol:realm:authenticationMethod:)`](/documentation/Foundation/URLProtectionSpace/init(host:port:protocol:realm:authenticationMethod:)) and [`init(proxyHost:port:type:realm:authenticationMethod:)`](/documentation/Foundation/URLProtectionSpace/init(proxyHost:port:type:realm:authenticationMethod:)).

## Topics

### Session-wide authentication challenges

These constants indicate session-wide challenges. Delegates handle these challenges in the [`URLSessionDelegate`](/documentation/Foundation/URLSessionDelegate)

A protocol that defines methods that URL session instances call on their delegates to handle session-level events, like session life cycle changes. method [`-  URLSession:didReceiveChallenge:completionHandler:`](/documentation/Foundation/URLSessionDelegate/urlSession(_:didReceive:completionHandler:))

Requests credentials from the delegate in response to a session-level authentication request from the remote server..

[`NSURLAuthenticationMethodClientCertificate`](/documentation/Foundation/NSURLAuthenticationMethodClientCertificate)

Use client certificate authentication for this protection space.

[`NSURLAuthenticationMethodNegotiate`](/documentation/Foundation/NSURLAuthenticationMethodNegotiate)

Negotiate whether to use Kerberos or NTLM authentication for this protection space.

[`NSURLAuthenticationMethodNTLM`](/documentation/Foundation/NSURLAuthenticationMethodNTLM)

Use NTLM authentication for this protection space.

[`NSURLAuthenticationMethodServerTrust`](/documentation/Foundation/NSURLAuthenticationMethodServerTrust)

Perform server trust authentication (certificate validation) for this protection space.

### Task-specific authentication challenges

These constants indicate task-specific challenges. Delegates handle these challenges in the [`URLSessionTaskDelegate`](/documentation/Foundation/URLSessionTaskDelegate)

A protocol that defines methods that URL session instances call on their delegates to handle task-level events. method [`-  URLSession:task:didReceiveChallenge:completionHandler:`](/documentation/Foundation/URLSessionTaskDelegate/urlSession(_:task:didReceive:completionHandler:))

Requests credentials from the delegate in response to an authentication request from the remote server..

[`NSURLAuthenticationMethodDefault`](/documentation/Foundation/NSURLAuthenticationMethodDefault)

Use the default authentication method for a protocol.

[`NSURLAuthenticationMethodHTMLForm`](/documentation/Foundation/NSURLAuthenticationMethodHTMLForm)

Use HTML form authentication for this protection space.

[`NSURLAuthenticationMethodHTTPBasic`](/documentation/Foundation/NSURLAuthenticationMethodHTTPBasic)

Use HTTP basic authentication for this protection space.

[`NSURLAuthenticationMethodHTTPDigest`](/documentation/Foundation/NSURLAuthenticationMethodHTTPDigest)

Use HTTP digest authentication for this protection space.

## See Also

[Handling an authentication challenge](/documentation/Foundation/handling-an-authentication-challenge)

Respond appropriately when a server demands authentication for a URL request.

[Performing manual server trust authentication](/documentation/Foundation/performing-manual-server-trust-authentication)

Evaluate the server’s security credentials in your app.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)