---
title: "createSession(_:)"
framework: cryptotokenkit
role: symbol
role_heading: Instance Method
path: "cryptotokenkit/tktokendelegate/createsession(_:)"
---

# createSession(_:)

Tells the delegate to create a session for the specified token.

## Declaration

```swift
func createSession(_ token: TKToken) throws -> TKTokenSession
```

## Parameters

- `token`: The token.

## Return Value

Return Value A new token session, or nil if an error occurred.

## Discussion

Discussion All operations for a token are performed within a session representing an authentication context. This delegate method is called whenever new authentication context is needed. For example, a client may want to perform a token operation using a keychain object that has an associated LAContext.

## See Also

### Delegate Methods

- [token(_:terminateSession:)](cryptotokenkit/tktokendelegate/token(_:terminatesession:).md)
