Once you've initialized the SDK, you need to tell Zendesk how to identify your users.

Support SDK (Required)

The Support SDK provides two authentication options: "anonymous" identity and JWT. For detailed instructions, see Setting an identity in the Support SDK documentation.

In a nutshell, create either an AnonymousIdentity or a JwtIdentity, depending on which authentication type was selected on the Mobile SDK page in the Zendesk Support admin:

Identity identity = new AnonymousIdentity.Builder()                .withNameIdentifier("Name") // name is optional                .withEmailIdentifier("[email protected]") // email is optional                .build();


Identity identity = new JwtIdentity("myJwtUserIdentifier");

Next, set this object on the Zendesk singleton:


Once you've set an identity, see Support engine for instructions on starting the MessagingActivity with an instance of SupportEngine.

Answer Bot SDK (Required)

The Answer Bot SDK shares its authentication mechanism with the Support SDK. The same identity is used for interactions with Answer Bot. Follow the instructions in Support SDK above to set an identity.

Once you've set an identity, see Answer Bot engine for instructions on starting the MessagingActivity with an instance of AnswerBotEngine.

Note: Zendesk has renamed our bot capabilities. Answer Bot is now Zendesk bots. For more information on this change, see this announcement.

Chat SDK (Optional)

Like the Support and Answer Bot SDK, the Chat SDK supports both anonymous and authenticated users with JWT. An anonymous identity is created automatically if JWT authentication is not used. You can provide visitor information to the chat backend with VisitorInfo for an anonymous session.

To create a JWT identity for your end user, you will first need to conform to the JWTAuthenticator object interface. The class that conforms to the interface must contain the getToken function. This is where you should retrieve the JWT from your service:

JwtAuthenticator jwtAuthenticator = new JwtAuthenticator() {            @Override            public void getToken(JwtCompletion jwtCompletion) {                //Your code for getting a JWT token here
                jwtCompletion.onTokenLoaded("YOUR JWT STRING");
                // if JWT token generation fails                jwtCompletion.onError            }        };

After you conform to the interface, pass an instance of the interface to the setIdentity function of the Chat instance:


Chat will call getToken before the chat connects to the backend and validate the authentication token. If authentication fails the chat proceed as an anonymous session, and an error will be logged. If the SDK needs to re-authenticate the user at any point during the chat conversation and fails, the current conversation will end, and a new conversation will begin as an anonymous session. In both of these failure cases, the user will appear as non-authenticated to any other parties participating in the chat conversation.

Follow the article for a walkthrough on setting up Chat authentication. Or you can take a look at the sample app.

Resetting a user's identity in Chat SDK

You can reset the identity of a user which will force a new unique identifier to be generated. This will cause them to be unassociated with the any ongoing chats and the local cache to be discarded. Important This will also cause agents to no longer see previous chats as they will be identified as a new anonymous user.

Chat.INSTANCE.resetIdentity(new CompletionCallback<Void>() {    @Override    public void onCompleted(Void result) {        // Identity was reset    }});