<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoTokenKit",
  "identifier" : "/documentation/CryptoTokenKit/TKTokenSessionDelegate/tokenSession(_:beginAuthFor:constraint:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CryptoTokenKit"
    ],
    "preciseIdentifier" : "c:objc(pl)TKTokenSessionDelegate(im)tokenSession:beginAuthForOperation:constraint:error:"
  },
  "title" : "tokenSession(_:beginAuthFor:constraint:)"
}
-->

# tokenSession(_:beginAuthFor:constraint:)

Tells the delegate that authentication has begun for the specified operation and constraint.

```
optional func tokenSession(_ session: TKTokenSession, beginAuthFor operation: TKTokenOperation, constraint: Any) throws -> TKTokenAuthOperation
```

## Parameters

`session`

The token session.

`operation`

The kind of operation.

`constraint`

The constraint to be satisfied.

## Return Value

The resulting context of the operation, or `nil` if an error occurred.

## Discussion

If you return an instance of a subclass of [`TKTokenAuthOperation`](/documentation/CryptoTokenKit/TKTokenAuthOperation) that is provided by the CryptoTokenKit framework, the system will first fill in the context-specific properties, such as the password, before calling the `finishWithError:` method on the context.

---

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)