Token Base Authentication
Token base auth is system that customer can register into Diyalog sdk with their application User Info, and can chat between thier application user.
With DiyalogSDK User can register in forground mode as well as background mode. Before authentication user need to init DiyalogSDK as below.
#
DOMAIN CUSTOMER USERa. Foreground method For customer user registration client need to call below method with necessary information. After successfully register on server it will create session in Diyalog SDK and can start messaging. Using below method if user already created session in Diyalog SDK, then it will directly open that session and user can start messaging.
context - Activity context dlgToken - Main application server will return Diyalog Token when user will login into main application DeviceId - domain specific device id. this is for domain validation CustId - domain customer id CustName - customer name CustPhone - customer phone number (Optional) CustEmail – customer email address (Optional)
b. Background method When customer user will call background method then it will be register on server and after successfully register, it will create session into sdk. And when user will click on Diyalog chat icon from main application to open sdk, it will directly open that session. user does not wait for register. And In background method if there is any failure then it will pass error message into failure callback.
#
DOMAIN STAFF USERa. Foreground method For staff user registration client need to call below method with necessary information. After successfully register on server it will create session in Diyalog SDK and can start messaging. Using below method if user already created session in Diyalog SDK, then it will directly open that session and user can start messaging.
context - Activity context dlgToken - Main application server will return Diyalog Token when user will login into main application sessionId – Staff user's sessionId userId - Staff user's UserID UserName - Staff user's UserName userPhone - Staff user's PhoneNumber(Optional) userEmail - Staff user's EmailID (Optional)
b. Background method When staff user will call background method then it will be register on server and after successfully register, it will create session into sdk. And when user will click on Diyalog chat icon from main application to open sdk, it will directly open that session. user does not wait for register. And In background method if there is any failure then it will pass error message into failure callback.
#
Get Active sessionsUser can get all sessions list those already registered in diyalog SDK. This method will be use for both Domain customer user and staff user.
This method will return list of saved session from sdk. It will contain userInfo as below:
- ApplicationUserID
- AuthID
- UserName
- User Image.
#
Messaging from specific UserUser can start messaging from specific user. If session already saved into Diyalog SDK then user can start messaging with thier UserID.
context - Activity context customerId - domain customer id
This method will be use for both Domain customer user and staff user.