400-881-9892

文档中心

官方文档,可查阅产品介绍、快速入门、用户指南、开发指南、API参考、SDK参考、帮助等信息。

文档中心 互动课堂

About The Token Generation Explanation

    Generation of tk_token
    1. Information association Need to obtain the following information: companyDomain:Corporate domain name (required) authKey:Corporate key (required) thirdRoomId:Third-party room number (required) userId:User ID (required) ts:Current timestamp (in seconds) (required)

    expireTs: Expiration timestamp. The number of seconds elapsed since January 1, 1970, at 00:00:00 UTC. For example, if you want to set the permission to expire 10 minutes after the generation of TK-Sign, you should set the expireTs to the current timestamp plus 600 seconds. If the permission should never expire, please fill in 0.

    For the acquisition of the corporate domain name and authKey, please refer to the enterprise management backend to view the enterprise details information

    1. aes encryption signString = "appId=companyDomain&thirdRoomId=thirdRoomId&userId=userId&ts=ts&expireTs=expireTs" tk_token = aes(signString, authKey)

    2. Example

    1
    2
    3
    4
    5
    6
    7
    8
    var companyDomain = "yourDomain";
    var authKey = "abcd1234efg";
    var roomId = "1473793911 ";
    var userId = "ade123456 ";
    var privilegeExpiredTs = "0";
    var ts = "1733803340"
    var signString = "appId=yourDomain&thirdRoomId=1473793911&userId=ade123456&ts=1733803340&expireTs=0"
    var tk_token = aes(signString, "abcd1234efg");
    
    Usage of the SDK

    Only the joinRoomEx method requires the use of tk_token. Simply pass this parameter to the tk_token field within the roomJsonOptions parameter of the method

    1
    room.joinRoomEx({roomId:  "1473793911",  tk_token: tk_token }, { userId: "ade123456", role: 2,nickname: "test" })