User Verification for Android
Pass user verification information to Salesforce to ensure that your customers get the best experience with a rep.
This feature requires version 1.2.0 or later of the Enhanced In-App Chat SDK.
This article applies to the following implementations:
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.
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.
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.
- When creating the
UIConfiguration or CoreConfiguration object, add the optional isUserVerificationRequired argument and set it to true. See the CoreConfiguration reference documentation.
- Implement the
UserVerificationProvider interface. This provider contains the userVerificationChallenge method, which the SDK calls when it requires user verification information.
- Add your provider to the SDK using the
CoreClient.registerUserVerificationProvider property. See the CoreClient reference documentation.
- Revoke the token when the user logs out by calling
CoreClient.revokeToken. See the CoreClient reference documentation.
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 or Build a Core SDK App for more information.
1// Set the user verification flag on the config object to true
2val config = CoreConfiguration.fromFile(this, "configFile.json", true)
3
4// Create a core client from a config
5val coreClient = CoreClient.Factory.create(myContext, config)
6
7// Register a provider
8coreClient.registerUserVerificationProvider( object : UserVerificationProvider {
9
10 // Implement the user verification challenge method
11 override suspend fun userVerificationChallenge(reason: ChallengeReason): UserVerificationToken {
12
13 // Get the JWT token
14 val type = UserVerificationType.JWT
15 val token = "{ JWT token goes here }"
16
17 // Pass the token to the SDK
18 return UserVerificationToken(type, token)
19 }
20})
After you register your provider, the SDK automatically calls the userVerificationChallenge method when it needs a valid token.