Chat UIKit Flutter v3
Chat UIKit Flutter
Chat UIKit
Flutter
Version 3

Authentication

Copy link

In order to use the features of Sendbird UIKit for Flutter in your client apps, a SendbirdUIKit instance must be initiated in each client app through user authentication with Sendbird server. The instance communicates and interacts with the server using an authenticated user account, and is allowed to use the UIKit's features. This page explains how to authenticate your user with the server.

--

Overview

Copy link

Authentication is required to use Sendbird’s features. There are three ways to authenticate:

  1. Guest Login: A token is not required. However, this method is not recommended for production due to security vulnerabilities. You use a UserID only to authenticate.

Note: You can turn off this feature in Access token permission on Sendbird Dashboard.

  1. Access Token: A token that does not expire. It can be generated by API or from the Dashboard.

  2. Session Token: Highly recommended for enhanced security.

Note: This document does not cover session handling. Refer to this SDK document to learn more.


Connect to Sendbird server

Copy link

Connect a user to Sendbird server using the SendbirdUIKit.connect() method. The connect() method also automatically updates the user profile on the server.

Refer to the code below to see how to connect a user to Sendbird server:

bool result = await SendbirdUIKit.connect(
    'YOUR_USER_ID',
    accessToken: 'YOUR_ACCESS_TOKEN',
);

Disconnect from Sendbird server

Copy link

Call the SendbirdUIKit.disconnect() method if the user requests to log out. If a user has been logged out and thus disconnected from the server, they will no longer receive messages.

bool result = await SendbirdUIKit.disconnect();