tencent cloud

Mobile Live Video Broadcasting

Release Notes and Announcements
TUILiveKit Release Notes
Live SDK Release Notes
User Guide
Product Introduction
Overview
Strengths
Performance Statistics
Concepts
Purchase Guide
TRTC Live Billing Overview
Billing of Video Live Component
Activating the Service (TUILiveKit)
Free Demo
Demo
Run Demo(TUILiveKit)
Integration Guide
Video Live Streaming
Preparation
Host Live Streaming
Audience Viewing
Live Stream List Live Stream List
Voice Chat Room
Preparation
Host Live Streaming
Audience Viewing
Live Stream List
Live Streaming Kit
Live Streaming Kit(Electron Desktop Application)
Live Streaming Kit(Web Desktop Browser)
Live Broadcast Monitoring
Monitoring Webpage (Web Desktop Browser React)
Monitoring Webpage (Web Desktop Browser Vue)
UI Customization
Live Stream Video Component
Video Source Editing Canvas
Audience List Component
Barrage Component
Media Source Configuration Panel
Link Management Panel
Live Gift Component
No UI Integration
Video Live Streaming
Voice Chat Room
Feature Guide
Follow Anchors (TUILiveKit)
Ultimate Image Quality (TUILiveKit)
Push Media Stream Into Room (TUILiveKit)
Gift System (TUILiveKit)
Client APIs
Android
iOS
Web
Server APIs (TUILiveKit)
Account System
REST API
Third-Party Webhooks
Error Codes (TUILiveKit)
FAQs
Platform Compilation
User Authentication
Live SDK
Product Introduction
Purchase Guide
Free Demo
Free Trial License
SDK Download
Licenses
Advanced Features
Client API
FAQs
Integration (No UI)
API Documentation
OSS information
OSS Attribution Notice

User Authentication

포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-01-14 19:47:14

Overview

This document outlines two authentication methods for Tencent-RTC services, with a focus on UserSig, a security signature by Tencent Cloud to safeguard against unauthorized access. For basic cloud service usage, provide SDKAppID, UserID, and UserSig during SDK initialization or login.
SDKAppID is used to identify your application.
UserID is used to identify your user.
UserSig is a security signature calculated based on the first two using the HMAC SHA256 encryption algorithm. As long as attackers cannot forge the UserSig, they cannot steal your cloud service traffic.

How to calculate UserSig during the debugging phase?

You can calculate and obtain UserSig using either Client Sample Code or the Console. Please refer to the following introduction for details.
Unsafe:
Note that the following two UserSig acquisition calculation schemes are only suitable for debugging. If the product is to be officially launched, using these schemes is not recommended because the SECRETKEY in the client code (especially on the Web) is easily vulnerable to decompilation and reverse engineering.

Client calculation of UserSig

1. Get SDKAppID and Key:

Log in to Tencent-RTC Console > App Management.
Locate the app with the desired SDKAppID, click its name for details.
Click on SDKSecretKey to reveal and copy.




2. Calculate UserSig:

To facilitate client use, we provide source files for calculating UserSig on various platforms. You can download and use them directly:
Android
iOS
Web
Windows(C++)
Windows(C#)
Flutter
Mac
GitHub
GitHub
GitHub
GitHub
GitHub
GitHub
GitHub
The sample code is as follows (of course, you can also refer to the demo projects of our products, see the development documentation of each product):
Android
iOS
Web
Window(C++)
Window(C#)
Flutter
Mac
// Step 1: Import the source file
import com.xxx.xxx.GenerateTestUserSig;

// Step 2: Fill in the SDKAppID and SDK key obtained from the previous steps
GenerateTestUserSig.SDKAPPID = xxxxxx;
GenerateTestUserSig.SECRETKEY = "xxxxxx";

// Step 3: Generate userSig based on userID
String userSig = GenerateTestUserSig.genTestUserSig("userID");
// Step 1: Import the header file
#import "GenerateTestUserSig.h"

// Step 2: Fill in the SDKAppID and SDK key obtained from the previous steps
[GenerateTestUserSig setSDKAPPID:xxxxxx];
[GenerateTestUserSig setSECRETKEY:@"xxxxxx"];

// Step 3: Generate userSig based on userID
NSString *userSig = [GenerateTestUserSig genTestUserSig:@"userID"];

// Step 1: Import the module
<script src='js/libs/lib-generate-test-usersig.min.js'></script>
<script src='js/libs/generateTestUserSig.js'></script>

// Step 2: Fill in the SDKAppID and SDK key obtained from the previous steps, enter the custom userID, and generate userSig
const {sdkAppId, userSig } = genTestUserSig({
sdkAppId: xxxxxx,
userId: 'xxxxxx',
sdkSecretKey: 'xxxxxx',
}
// Step 1: Import the header file
#include "GenerateTestUserSig.h"

// Step 2: Fill in the SDKAppID and SDK key obtained from the previous steps
const int SDKAPPID = xxxxxx;
const char* SECRETKEY = "xxxxxx";

// Step 3: Generate userSig based on userID
const char* userSig = GenerateTestUserSig::genTestUserSig("userID", SDKAPPID, SECRETKEY);
// Step 1: Import the header file
using GenerateTestUserSig;

// Step 2: Fill in the SDKAppID and SDK key obtained from the previous steps
GenerateTestUserSig.SDKAPPID = xxxxxx;
GenerateTestUserSig.SECRETKEY = "xxxxxx";

// Step 3: Generate userSig based on userID
string userSig = GenerateTestUserSig.GetInstance().GenTestUserSig("userID");
// Step 1: Import the source file
import 'package:xxx/GenerateTestUserSig.dart';

// Step 2: Fill in the SDKAppID and SDK key obtained from the previous steps
GenerateTestUserSig.SDKAPPID = xxxxxx;
GenerateTestUserSig.SECRETKEY = "xxxxxx";

// Step 3: Generate userSig based on userID
String userSig = GenerateTestUserSig.genTestUserSig("userID");
// Step 1: Import the header file
#import "GenerateTestUserSig.h"

// Step2: Enter the SDKAppID and SDK secret obtained in the Back step
[GenerateTestUserSig setSDKAPPID:xxxxxx];
[GenerateTestUserSig setSECRETKEY:@"xxxxxx"];

// Step 3: Generate userSig based on userID
NSString *userSig = [GenerateTestUserSig genTestUserSig:@"userID"];

Get UserSig from the console

Log in to Tencent-RTC Console, navigate to Development Tools > UserSig Tools.
Under the UserSig Generation Tool, select the corresponding SDKAppID and UserID.
Click the Generate button to compute the corresponding UserSig.




How to calculate UserSig during the official operation phase?

During the official operation phase, Tencent-RTC provides a more secure server-side UserSig calculation solution. This maximizes the protection of the key used to calculate UserSig from being leaked, as compromising a server is more difficult than reverse engineering an app. The specific implementation process is as follows:

1. Before your app calls the SDK initialization function, it must first request UserSig from your server.
2. Your server calculates UserSig based on SDKAppID and UserID. Refer to the first part of the documentation for the source code.
3. The server returns the calculated UserSig to your app.
4. Your app passes the obtained UserSig to the SDK via a specific API.
5. The SDK submits SDKAppID + UserID + UserSig to Tencent CVM for verification.
6. Tencent Cloud verifies UserSig to confirm its validity.
7. After verification, Tencent-RTC services will be provided to the Tencent-RTC SDK.
To simplify your implementation process, we provide UserSig Calculation Source Code and examples in multiple language versions:
Language Version
Signature algorithm
Source Code
Usage Examples
Java
HMAC-SHA256
genSig
GitHub
Go
HMAC-SHA256
genSig
GitHub
PHP
HMAC-SHA256
genSig
GitHub
Node.js
HMAC-SHA256
genSig
GitHub
Python
HMAC-SHA256
genSig
GitHub
C#
HMAC-SHA256
GenSig
GitHub


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백