How to upgrade Express from AppSign authentication to Token authentication?
Document Guide
To improve the security of your project, for developers using AppSign authentication, after your product upgrades to the following versions, you can use Token authentication and can only use related services after authentication passes (if you don't need it, you can continue to use AppSign authentication). You can refer to this document for upgrade.
-
Video Call
- iOS/Android/macOS/Windows/Unity3D: Version 2.17.0 and above
- Flutter: Version 2.17.1 and above
- React Native: Version 0.17.0 and above
- uni-app: Version 1.5.0 and above
- Electron: Version 2.17.3 and above
- Linux (C++): Version 2.17.3 and above
-
Local Server Recording
ga01596a1c8 and above (released on 2022-03-23)
-
Super Board
iOS/Android: Version 2.3.0 and above (released on 2022-05-26)
-
Interactive Whiteboard
Note: When using Interactive Whiteboard SDK, for Token authentication related steps, please refer to Using Token - Video Call. The following will not be repeated.
- iOS/Android: Version 2.3.0 and above (released on 2022-05-26)
- Electron: Version 2.1.6 and above (released on 2022-05-26)
-
File Sharing
- iOS/Android: Version 2.3.0 and above (released on 2022-05-26)
- Electron: Version 2.1.6 and above (released on 2022-05-26)
Authentication Methods
| Authentication Method | Function Description | Security Level |
|---|---|---|
| AppSign Authentication | Pass AppSign when creating the engine. After authentication passes, you can use real-time audio and video functionality. | Very low security level. Reason: If AppSign is leaked, attackers will steal your cloud service traffic, and AppSign has no expiration mechanism. It is recommended that you upgrade to Token authentication as soon as possible. |
| Token Authentication (Recommended) | Token authentication means passing AppSign as empty or not passing it when creating the engine, and you must pass Token when logging into a room. After authentication passes, you can use real-time audio and video functionality. This method is compatible with AppSign authentication. That is, when you pass both AppSign and Token, the SDK will pass both parameters to the ZEGO server. As long as one of them passes verification, authentication is considered passed. | High security level. Reason: Token is issued by the developer's self-built server and authenticated on the client side, and the issued Token has a time limit. Therefore, we recommend you use Token authentication. |
| Forced Token Authentication | This method refers to configuring forced Token authentication service through ZEGOCLOUD Technical Support. At this time, Token authentication must be used. After authentication passes, you can use real-time audio and video functionality. This method is not compatible with AppSign authentication. | Highest security level. Reason: After forced Token authentication is enabled, AppSign authentication is no longer compatible, further improving security. However, old versions using AppSign authentication online will not work properly. You need to use this carefully. |
Compatibility Description
The three authentication methods of AppSign authentication, Token authentication, and forced Token authentication have certain compatibility. If your historical version uses AppSign authentication, then:
- Do not enable forced Token authentication switch (default): ZEGO Express SDK new version can use Token authentication or AppSign authentication.
- Enable forced Token authentication switch: ZEGO Express SDK, whether new or old version, is forced to use Token authentication and is not compatible with AppSign authentication.
For version information, please refer to Document Guide.
Upgrade Guide
Service Activation
Token authentication is activated by default.
If you need to enable forced Token authentication, please contact ZEGOCLOUD Technical Support.
Generate Token
The developer client sends a request to the developer server to apply for Token. The developer server generates Token and returns it to the corresponding client.
ZEGO provides an open-source zego_server_assistant plugin on GitHub/Gitee, supporting Go, C++, Java, Python, PHP, .NET, Node.js languages to deploy and generate Token on the developer's server or client (not recommended for client generation).
zego_server_assistant contains two versions of plugins: token03 and token04. Taking ZEGO Express SDK iOS platform as an example, the SDK's support for the plugin is as follows:
- token03: Supported by ZEGO Express SDK 2.8.0 and above.
- token04: Only supported by ZEGO Express SDK 2.17.0 and above.
For detailed introduction on generating Token, please refer to the following documentation:
| Product | Reference Documentation |
|---|---|
| Video Call | |
| Real-time Voice | |
| Local Server Recording | Linux |
| Super Board | |
| Interactive Whiteboard | |
| File Sharing |
Use Token
This chapter mainly introduces how to use Token functionality after upgrading the SDK.
| Product | Platform |
|---|---|
| Video Call/Real-time Voice | |
| Local Server Recording | Linux |
| Super Board | |
| File Sharing |
Video Call/Real-time Voice
The implementation process for each platform is as follows:
iOS- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- When calling the createEngine interface to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
ZegoEngineProfile *profile = [[ZegoEngineProfile alloc] init];
// Please get through official website registration, format: 1234567890
profile.appID = appID;
// For general scenario access, please choose the appropriate scenario based on your actual situation
profile.scenario = ZegoScenarioDefault;
// Create engine and register self as eventHandler callback. If you don't need to register callback, the eventHandler parameter can be passed nil. You can call "-setEventHandler:" method later to set callback
[ZegoExpressEngine createEngineWithProfile:profile eventHandler:self];- When calling the loginRoom interface to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomCofig.
NSString *roomID = @"xxx"; // Room ID to login
ZegoUser *user = [ZegoUser userWithUserID:@"xxxx"];
ZegoRoomConfig *config = [[ZegoRoomConfig alloc] init];
config.token = @"xxxxxxxx"; // Request from developer server
[[ZegoExpressEngine sharedEngine] loginRoom:roomID user:user config:config];- After receiving the onRoomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
NSString *token = [MyToken getToken]; // Request Token from developer server again
[[ZegoExpressEngine sharedEngine] renewToken:token roomID:roomID];- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- When calling the createEngine interface to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
// Create engine, general scenario access, and register self as eventHandler callback
// If you don't need to register callback, the eventHandler parameter can be passed null. You can call "setEventHandler:" method later to set callback
ZegoEngineProfile profile = new ZegoEngineProfile();
profile.appID = ; // Please get through official website registration, format: 1234567890L
profile.scenario = ZegoScenario.DEFAULT; // For general scenario access, please choose the appropriate scenario based on your actual situation
profile.application = getApplication();
engine = ZegoExpressEngine.createEngine(profile, null);- When calling the loginRoom interface to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
String roomID = "xxx" // Room ID to login
ZegoUser user = new ZegoUser("xxxx");
ZegoRoomConfig config = new ZegoRoomConfig();
config.token = "xxxxxxxxxx"; // Request from developer server
engine.loginRoom(roomID, user, config);- After receiving the onRoomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
String token = getToken(); // Request Token from developer server again;
engine.renewToken(roomID, token);- If you are using Objective-C: Please refer to iOS.
- If you are using C++: Please refer to Windows.
- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- When calling the createEngine interface to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
ZegoEngineProfile profile;
// AppID is assigned by ZEGO to each App
profile.appID = appID;
// For general scenario access, please choose the appropriate scenario based on your actual situation
profile.scenario = ZegoScenario::ZEGO_SCENARIO_DEFAULT;
// Create engine instance
auto engine = ZegoExpressSDK::createEngine(profile, nullptr);- When calling the loginRoom interface to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
std::string roomID = 'xxx'; // Room ID to login
ZegoUser user;
user.userID = 'xxxx';
user.userName = 'xxxx';
ZegoRoomConfig config;
config.token = 'xxxxxxxxxx' // Request from developer server
engine->loginRoom(roomID, user, config);- After receiving the onRoomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
void onRoomTokenWillExpire(const std::string& /*roomID*/, int /*remainTimeInSecond*/) override {
std::string token = getToken(); // Request Token from developer server again
engine->renewToken(roomID, token);
}- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- When calling the CreateEngine interface to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
// Define SDK engine object
ZegoExpressEngine engine;
ZegoEngineProfile profile = new ZegoEngineProfile();
profile.appID = appID; // Please get through official website registration, format: 123456789
profile.scenario = ZegoScenario.Default; // For general scenario access, please choose the appropriate scenario based on your actual situation
// Initialize SDK
engine = ZegoExpressEngine.CreateEngine(profile);- When calling the LoginRoom interface to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
string roomID = "xxx"; // Room ID to login
ZegoUser user = new ZegoUser();
user.userID = "xxxx";
user.userName = "xxxx";
ZegoRoomConfig config = new ZegoRoomConfig();
config.token = "xxxxxxxxxx"; // Request from developer server
engine.LoginRoom(roomID, user, config);- After receiving the onRoomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
void OnRoomTokenWillExpire(string roomID, int remainTimeInSecond){
string token = getToken(); // Request Token from developer server again
engine.RenewToken(roomID, token);
}- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- When calling the createEngineWithProfile interface to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
ZegoEngineProfile profile = ZegoEngineProfile(
appID, // Please get through official website registration, format: 1234567890
ZegoScenario.General, // General scenario access
enablePlatformView: true);
// Create engine
ZegoExpressEngine.createEngineWithProfile(profile);- When calling the loginRoom interface to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
// Create user object
ZegoUser user = ZegoUser.id('user1');
// Only ZegoRoomConfig with "isUserStatusNotify" parameter set to "true" can receive onRoomUserUpdate callback.
ZegoRoomConfig config = ZegoRoomConfig.defaultConfig();
config.isUserStatusNotify = true;
// Token is generated by the user's own server. To quickly run through the process, you can also get temporary audio and video tokens through the ZEGOCLOUD console
config.token = "xxxx";
// Start logging in to the room
ZegoExpressEngine.instance.loginRoom('room1', user, config: config);- After receiving the onRoomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
ZegoExpressEngine.onRoomTokenWillExpire = (String roomID, int remainTimeInSecond) {
String token = getToken(); // Request Token from developer server again;
ZegoExpressEngine.instance.renewToken(roomID, token);
};- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- When calling the createEngineWithProfile interface to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
// Import
import ZegoExpressEngine from 'zego-express-engine-reactnative';
// Use general scenario
const profile = {
appID : xxx,
scenario : 0
};
ZegoExpressEngine.createEngineWithProfile(profile)- When calling the loginRoom interface to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
let roomConfig = {};
// Token is generated by the user's own server. To quickly run through the process, you can also get temporary audio and video tokens through the ZEGOCLOUD console
roomConfig.token = "xxxx";
// Only ZegoRoomConfig with "isUserStatusNotify" parameter set to "true" can receive onRoomUserUpdate callback.
roomConfig.isUserStatusNotify = true;
// Login to room
// Start logging in to the room
ZegoExpressEngine.instance().loginRoom('room1', {'userID': 'id1', 'userName': 'user1'}, roomConfig);- After receiving the roomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
ZegoExpressEngine.instance().on("roomTokenWillExpire", (roomID, remainTimeInSecond){
let token = getToken(); // Request Token from developer server again;
ZegoExpressEngine.instance().renewToken(roomID, token);
});- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- When calling the createEngineWithProfile interface to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
// Import
import ZegoExpressEngine from '@/zego-express-video-uniapp/lib/ZegoExpressEngine';
// Use general scenario
const profile = {
appID : xxx,
scenario : 0
};
ZegoExpressEngine.createEngineWithProfile(profile)- When calling the loginRoom interface to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
let roomConfig = {};
// Token is generated by the user's own server. To quickly run through the process, you can also get temporary audio and video tokens through the ZEGOCLOUD console
roomConfig.token = "xxxx";
// Only ZegoRoomConfig with "isUserStatusNotify" parameter set to "true" can receive onRoomUserUpdate callback.
roomConfig.isUserStatusNotify = true;
// Login to room
// Start logging in to the room
ZegoExpressEngine.instance().loginRoom('room1', {'userID': 'id1', 'userName': 'user1'}, roomConfig);- After receiving the roomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
ZegoExpressEngine.instance().on("roomTokenWillExpire", (roomID, remainTimeInSecond){
let token = getToken(); // Request Token from developer server again;
ZegoExpressEngine.instance().renewToken(roomID, token);
});- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- When calling the createEngine interface to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
// Import ZegoExpressEngine
const zgEngine = window.require('zego-express-engine-electron/ZegoExpressEngine');
const zgDefines = window.require('zego-express-engine-electron/ZegoExpressDefines');
// AppID is assigned by ZEGO to each App. Starting from version 2.17.3, ZEGO no longer issues appSign. Users can leave appSign empty or not fill it when creating the engine, but to use the SDK's functions normally, you must pass token for authentication verification when logging into a room.
// Use general scenario
const profile = {
appID : xxx,
scenario : zgDefines.ZegoScenario.General
};
zgEngine.createEngine(profile)
.then(() => {
console.log("init succeed")
}).catch((e) => {
console.log("init failed", e)
});- When calling the loginRoom interface to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
zgEngine.loginRoom('roomID', { userID: 'zego', userName: zego}, config = {token: 'xxxx'});- After receiving the onRoomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
zgEngine.on("onRoomTokenWillExpire", res=>
{
zgEngine.renewToken(roomID = TheRoomID, token = 'xxxx');
});- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- When calling the createEngine interface to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
ZegoEngineProfile profile;
// AppID is assigned by ZEGO to each App
profile.appID = appID;
profile.scenario = ZegoScenario::ZEGO_SCENARIO_DEFAULT;
// Create engine instance
auto engine = ZegoExpressSDK::createEngine(profile, nullptr);- When calling the loginRoom interface to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
std::string roomID = 'xxx'; // Room ID to login
ZegoUser user;
user.userID = 'xxxx';
user.userName = 'xxxx';
ZegoRoomConfig config;
config.token = 'xxxxxxxxxx' // Request from developer server
engine->loginRoom(roomID, user, config);- After receiving the onRoomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
void onRoomTokenWillExpire(const std::string& /*roomID*/, int /*remainTimeInSecond*/) override {
std::string token = getToken(); // Request Token from developer server again
engine->renewToken(roomID, token);
}Local Server Recording
Linux- Download and integrate the latest version of SDK. For details, please refer to Integrate SDK.
- Call the InitSDK interface to initialize the SDK and pass the obtained AppID to the parameter "uiAppID".
unsigned int appId = appID; // Fill in AppID here
LIVEROOM::InitSDK(appId);- Before logging into a room, call the SetCustomToken interface to pass Token to the SDK.
LIVEROOM::SetCustomToken("token"); // Fill in the correct authentication Token hereSuper Board
iOS- Download and integrate the latest version of ZegoSuperBoard SDK (which includes ZegoExpressEngine SDK). For details, please refer to Integrate SDK.
- When calling the createEngine interface of ZegoExpressEngine to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
ZegoEngineProfile *profile = [[ZegoEngineProfile alloc] init];
// Please get through official website registration, format: 1234567890
profile.appID = appID;
// For general scenario access, please choose the appropriate scenario based on your actual situation
profile.scenario = ZegoScenarioDefault;
// Create engine and register self as eventHandler callback. If you don't need to register callback, the eventHandler parameter can be passed nil. You can call "-setEventHandler:" method later to set callback
[ZegoExpressEngine createEngineWithProfile:profile eventHandler:self];- When initializing ZegoSuperBoard SDK using the initWithConfig method of ZegoSuperBoardManager, pass userID and fill in the Token generated by the developer server.
/** Fill in appID*/
unsigned int appID = ; /** Please get through official website registration, format: 123456789L */
// Create an initialization configuration class ZegoSuperBoardInitConfig
ZegoSuperBoardInitConfig * config = [ZegoSuperBoardInitConfig new];
config.appID = appID; // Assign appID
config.token = token; // Assign token
config.userID = userID; // Assign userID
// Set ZegoSuperBoardManager listener, need to set before logging into the room
[ZegoSuperBoardManager sharedInstance].delegate = self;
[[ZegoSuperBoardManager sharedInstance] initWithConfig:config complete:^(ZegoSuperBoardError errorCode) {
if (errorCode == ZegoSuperBoardSuccess) {
/** Initialization successful */
} else {
/** Initialization failed */
}
}];- When calling the loginRoom interface of ZegoExpressEngine to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
NSString *roomID = @"xxx"; // Room ID to login
ZegoUser *user = [ZegoUser userWithUserID:@"xxxx"];
ZegoRoomConfig *config = [[ZegoRoomConfig alloc] init];
config.token = @"xxxxxxxx"; // Request from developer server
[[ZegoExpressEngine sharedEngine] loginRoom:roomID user:user config:config];- After receiving the onRoomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
NSString *token = [MyToken getToken]; // Request Token from developer server again
[[ZegoExpressEngine sharedEngine] renewToken:token roomID:roomID];- Download and integrate the latest version of ZegoSuperBoard SDK (which includes ZegoExpressEngine SDK). For details, please refer to Integrate SDK.
- When calling the createEngine interface of ZegoExpressEngine to create the engine, pass AppSign as empty or do not pass it in ZegoEngineProfile.
// Create engine, general scenario access, and register self as eventHandler callback
// If you don't need to register callback, the eventHandler parameter can be passed null. You can call "setEventHandler:" method later to set callback
ZegoEngineProfile profile = new ZegoEngineProfile();
profile.appID = ; // Please get through official website registration, format: 1234567890L
profile.scenario = ZegoScenario.DEFAULT; // For general scenario access, please choose the appropriate scenario based on your actual situation
profile.application = getApplication();
engine = ZegoExpressEngine.createEngine(profile, null);- When initializing ZegoSuperBoard SDK using the init method of ZegoSuperBoardManager, pass userID and fill in the Token generated by the developer server.
// Configure appID, token and UserID required for superBoard initialization
ZegoSuperBoardInitConfig config = new ZegoSuperBoardInitConfig();
config.appID = appID; // Assign appID
config.token = token; // Assign token
config.userID = userID; // Assign userID
// Call SuperBoardManager to initialize SuperBoard sdk
// this is the Android Application context, so this code is recommended to be implemented in the Application
ZegoSuperBoardManager.getInstance().init(this, config, new IZegoSuperBoardInitCallback() {
@Override
public void onInit(int errorCode) {
Log.d(TAG, "init ZegoSuperBoardManager result: errorCode = [" + errorCode + "]");
if (errorCode == ZegoSuperBoardError.ZegoSuperBoardSuccess) {
/** Initialization successful */
} else {
/** Initialization failed */
}
}
});- When calling the loginRoom interface of ZegoExpressEngine to login to a room, you need to fill in the Token generated by the developer server in the room advanced configuration ZegoRoomConfig.
String roomID = "xxx" // Room ID to login
ZegoUser user = new ZegoUser("xxxx");
ZegoRoomConfig config = new ZegoRoomConfig();
config.token = "xxxxxxxxxx"; // Request from developer server
engine.loginRoom(roomID, user, config);- After receiving the onRoomTokenWillExpire callback, call the renewToken interface to update Token and pass it to the SDK.
String token = getToken(); // Request Token from developer server again;
engine.renewToken(roomID, token);File Sharing
iOS- Download and integrate the latest version of ZegoDocsView SDK. For details, please refer to Integrate SDK.
- When initializing ZegoDocsView SDK using the initWithConfig method of ZegoDocsViewManager, pass userID and fill in the Token generated by the developer server.
ZegoDocsViewConfig *config = [ZegoDocsViewConfig new];
config.appID = appID; // ZEGOCLOUD AppID
config.userID = userID; // User userID
config.token = token; // Authentication token, obtained from your own server
config.dataFolder = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/ZegoDocs"] stringByAppendingString:@"data"]; // SDK related data directory
config.cacheFolder = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/ZegoDocs"] stringByAppendingString:@"doc"]; // SDK related cache directory
config.logFolder = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/ZegoDocs"] stringByAppendingString:@"log"]; // SDK related log directory
[[ZegoDocsViewManager sharedInstance] initWithConfig:config completionBlock:^(ZegoDocsViewError errorCode) {
if (errorCode == ZegoDocsViewSuccess) {
NSLog(@"SDK initialization successful");
} else {
NSLog(@"SDK initialization failed %ld",errorCode);
}
}];- After receiving the
tokenWillExpirecallback, call therenewTokeninterface to update Token and pass it to the SDK.
- (void)tokenWillExpire
{
NSString * token = **; // Token obtained from backend
[[ZegoDocsViewManager sharedInstance] renewToken:token];
}- Download and integrate the latest version of ZegoDocsView SDK. For details, please refer to Integrate SDK.
- When initializing ZegoDocsView SDK using the init method of ZegoDocsViewManager, pass userID and fill in the Token generated by the developer server.
long appID = ; /** Please get through official website registration, format: 123456789L */
String token = ; /** Authentication token*/
String UserID = ; /** User unique ID*/
Application application ; // Android app's application
ZegoDocsViewConfig config = new ZegoDocsViewConfig();
config.setAppID(appID);
config.setToken(token);
config.setUserID(userID);
ZegoDocsViewManager.getInstance().init(application,config, new IZegoDocsViewInitListener() {
@Override
public void onInit(int errorCode) {
if (errorCode == 0) {
/** Initialization successful */
} else {
/** Initialization failed */
}
}
});- After receiving the
onTokenWillExpirecallback, call therenewTokeninterface to update Token and pass it to the SDK.
ZegoDocsViewManager.getInstance().setTokenListener(new IZegoDocsViewSetTokenListener() {
@Override
public void onTokenWillExpire(int remainTimeInSecond) {
// Get new token from server
String token = getTokenFromServer();
ZegoDocsViewManager.getInstance().renewToken(token);
}
});- Download and integrate the latest version of ZegoDocsView SDK. For details, please refer to Integrate SDK.
- When initializing ZegoDocsView SDK, pass userID and fill in the Token generated by the developer server.
/** Import ZegoExpressDocs SDK */
const ZegoExpressDocs = window.require('zego-express-docsview-electron');
/**
* Initialize ZegoExpressDocs SDK
* @param appID: Application ID issued by ZEGO for developers, please apply from ZEGO Management Console
* @param dataFolder: Optional, SDK internal data storage directory, developers do not need to pay attention to the specific content in this directory
* @param cacheFolder: Optional, SDK cache storage directory
* @param logFolder: Optional, log storage directory, records logs during SDK operation for easy troubleshooting
* @param token: Token for identity verification
* @param userID: Within the same AppID, "userID" must be globally unique
*/
const zegoExpressDocs = new ZegoExpressDocs({
appID,
dataFolder,
cacheFolder,
logFolder,
token,
userID
});- After receiving the
onTokenWillExpirecallback, call therenewTokeninterface to update Token and pass it to the SDK.
zegoExpressDocs.on('onTokenWillExpire', function(data){
var newToken = 'new token';
zegoExpressDocs.renewToken(newToken)
})