<!--
{
  "availability" : [
    "iOS: 9.0.0 - 18.0.0",
    "iPadOS: 9.0.0 - 18.0.0",
    "macCatalyst: 13.1.0 - 18.0.0",
    "macOS: 10.11.0 - 15.0.0",
    "tvOS: 17.0.0 - 18.0.0",
    "visionOS: 1.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NWTCPConnectionAuthenticationDelegate/provideIdentity(for:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(pl)NWTCPConnectionAuthenticationDelegate(im)provideIdentityForConnection:completionHandler:"
  },
  "title" : "provideIdentity(for:completionHandler:)"
}
-->

# provideIdentity(for:completionHandler:)

Provide the identity and an optional certificate chain to be used for authentication.

```
optional func provideIdentity(for connection: NWTCPConnection, completionHandler completion: @escaping (SecIdentity, [Any]) -> Void)
```

## Parameters

`connection`

The connection sending this message

`completion`

The completion handler for passing an identity and certificate chain to the connection.
The `identity` is required and must not be `nil`.
The `certificateChain` argument is optional, and is an array of one or more <doc://com.apple.documentation/documentation/Security/SecCertificate> objects.
The certificate chain must contain objects of type `SecCertificateRef` only.
If the certificate chain is set, it will be used.
Otherwise, the leaf certificate will be extracted from the <doc://com.apple.documentation/documentation/Security/SecIdentity> object and will be used for authentication.

    The caller is responsible for keeping the argument object(s) valid for the duration of the completion handler invocation.

## Discussion

Optional. If this method is not implemented, the default certificate evaluation will be used.

---

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)