---
schema_version: "1"
id: f46705be489fdca8b619fa6732f6f7ed02e50ee6c3196446dc2b2fca129998a9
title: User Verification for iOS
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/messaging-in-app/guides/ios-user-verification.md
canonical_url: https://developer.salesforce.com/docs/service/messaging-in-app/guide/ios-user-verification.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f0ebd3338c7f44f851dc3588a48c84d08066b3f181d55d5a2659652ce3db7624
products:
  - Enhanced In-App Chat
  - Service Cloud Developer Content
---
# User Verification for iOS

Pass user verification information to Salesforce to ensure that your customers get the best experience with a rep.


**important:** This feature requires version 1.2.0 or later of the Enhanced In-App Chat SDK.


This article applies to the following implementations:

| UI SDK | Core SDK |
| :----: | :------: |
|   ✅   |    ✅    |


Before you can use the SDK for user verification, you must upload the appropriate keys to Salesforce. To learn about and set up User Verification, see [User Verification in Salesforce Help](https://help.salesforce.com/s/articleView?id=service.user_verification.htm).

**tip:** Avoid using the same `ConversationID` when switching deployments, as conversations from one deployment might not be accessible in the other, especially when changing between unverified and verified users.

**note:** Currently, this feature supports JWT tokens. Also, we don’t support chatting with verified users alongside unverified users. Your implementation must be designed for either verified users or unverified users.


1. When creating the `UIConfiguration` or `Configuration` object, add the optional `userVerificationRequired` argument and set it to `true`. See the [`CoreConfiguration`](https://salesforce-async-messaging.github.io/messaging-in-app-ios/documentation/smiclientcore/configuration/) reference documentation.
2. Implement the [`UserVerificationDelegate`](https://salesforce-async-messaging.github.io/messaging-in-app-ios/documentation/smiclientcore/userverificationdelegate) interface. This delegate contains the `userVerificationChallengeWithReason` method, which the SDK calls when it requires user verification information.
3. Add your delegate to the SDK using the `CoreClient.userVerificationDelegate` property. See the [`CoreClient`](https://salesforce-async-messaging.github.io/messaging-in-app-ios/documentation/smiclientcore/coreclient) reference documentation.
4. Revoke the token when the user logs out by calling `CoreClient.revokeTokenAndDeregisterDevice`. See the [`CoreClient`](https://salesforce-async-messaging.github.io/messaging-in-app-ios/documentation/smiclientcore/coreclient) reference documentation.

```swift
class UserVerificationDelegateImplementation: UserVerificationDelegate {


  func core(_ core: CoreClient,
              userVerificationChallengeWith reason: ChallengeReason,
              completionHandler completion: @escaping UserVerificationChallengeCompletion) {
    // Create a user verification object using the JWT
    let customerIdentityToken = "{ JWT token goes here }"
    let userVerification = UserVerification(customerIdentityToken: customerIdentityToken,
                                            type: SMIAuthorizationType.SMIAuthorizationTypeJWT)

    // Pass the object to the SDK
    completion(userVerification, nil)
  }

}
```
**note:** This sample code requires the configuration object that you created when setting up the UI SDK or the Core SDK. See [Build a UI SDK App](https://developer.salesforce.com/docs/service/messaging-in-app/guide/ios-ui-sdk.md) or [Build a Core SDK App](https://developer.salesforce.com/docs/service/messaging-in-app/guide/ios-core-sdk.md) for more information.

```swift
// Create an instance of the user verification delegate
let myUserVerificationDelegate = UserVerificationDelegateImplementation()

// Set the user verification flag on the config object to true…
// If you're using the UI SDK:
let config = UIConfiguration(url: configURL, userVerificationRequired: true, conversationId: conversationID)
// Or, if you're using the Core SDK:
// let config = Configuration(url: configURL, userVerificationRequired: true)


// Create a core client from a config
let coreClient = CoreFactory.create(withConfig: config)

// Assign the user verification delegate
coreClient.userVerificationDelegate = myUserVerificationDelegate
```

After you register your delegate, the SDK automatically calls the `userVerificationChallegeWithReason` method when it needs a valid token.
