Home
/
Desk
/
iOS

Authentication

In order to use features of the Desk SDK in your client apps, the SBDSKMain instance should be connected with Sendbird server, and customers from Sendbird Chat should go through the user authentication with the Desk server using the SBDMain.initWithApplicationId(). Once authenticated, customers can live-chat with agents based on Sendbird Chat platform.

Note: Customers can request support from various types of channels. They can submit tickets from in-app chats or social media such as Facebook, Instagram and Twitter. Customers from social media are automatically registered in your dashboard with their social media accounts without any authentication process.


Initialize the Desk SDK with APP_ID

A SBDSKMain instance must be initialized when launching a client app. Call the SBDMain.initWithApplicationId() and SBDSKMain.initializeDesk() methods within the applicationDidFinishLaunching(). The initWithApplicationId() should be called first by the APP_ID of your Sendbird application in the dashboard. However, if you initiate the SBDSKMain again with a SBDMain instance initiated by a different APP_ID, all existing Desk-related data in the client app will be cleared.

Light Color Skin
Copy
// Initialize SBDSKMain instance to use APIs in your app.
class AppDelegate: UIApplicationDelegate {
    func applicationDidFinishLaunching(_ application: UIApplication) {
        SBDMain.initWithApplicationId(APP_ID)
        SBDSKMain.initializeDesk()
    }
}

Note: Built with Sendbird Chat platform, Sendbird Desk SDK is a plugin that handles customer inquiries through tickets. Messages within tickets are dealt with by Sendbird Chat platform, and every ticket is mapped to a group channel of Sendbird Chat. Because of this interaction, the same APP_ID should be used for both Desk and Chat SDKs.

It is possible to use the Chat SDK only or both Chat and Desk SDKs together in your client app depending on the chat service you want to provide.

Usage of SDKs

SDKUsed for

Chat SDK

In-app messenger where customers can chat with each other.

Chat and Desk SDKs

Tickets where customers can chat with agents.


Authenticate to the Desk server

If a customer comes from Sendbird Chat platform, authenticate them using the SBDSKMain.authenticate() method with the corresponding user ID after successfully being connected to Sendbird server. If the customer comes from social media such as Instagram or Facebook, they are automatically registered in the dashboard with their social media accounts without any authentication process.

Note: Customers from Sendbird Chat platform signifies users who are already authenticated with the Chat SDK. If you’re implementing Chat SDK and Desk SDK at the same time, connect a user to Sendbird server with their user ID and access token first.

Light Color Skin
Copy
// The USER_ID below should be unique to your Sendbird application.
SBDMain.connect(withUserId: USER_ID, accessToken: ACCESS_TOKEN) { (user, error) in
    guard error == nil else {
        // Handle error.
    }

    // Use the same user ID and access token used in the SBDMain.connect().
    SBDSKMain.authenticate(withUserId: USER_ID, accessToken: ACCESS_TOKEN) { (error) in
        guard error == nil else {
            // Handle error.
        }

        // SendBirdDesk is now initialized,
        // and the customer is authenticated and connected to Sendbird server.
        ...
    }
}