This document describes how to obtain the license file and the implementation steps of online authentication.
The license file refers to the software license and contains the following:
To implement the AI features provided by the ZegoEffects SDK
, an online user privilege authentication is required.
Online user privilege authentication refers to the process in which a client accesses the ZegoEffects Server
, applies for a license file, and performs network authentication.
We now provide two online authentication methods for you to implement the online authentication:
Method | Send requests from your app client | Send requests from your business server |
---|---|---|
Process |
|
|
Diagram |
||
Advantages |
|
|
Before you start to implement user privilege authentication in your app, contact the ZEGO team to apply for the AppID and AppSign for online user privilege validation.
ZegoEffects SDK
To get the authentication information, call the getAuthInfo
method with the AppSign you get in the previous step.
String encryptInfo = ZegoEffects.getAuthInfo(AppSign,context);
To get the license file after you get the authentication information, construct a message body that meets the following, and send the request to the ZegoEffects Server.
Parameter | Type | Required | Description |
---|---|---|---|
AppId | unsigned int | Yes | The unique identifier of the user privilege authentication, which can be obtained by contacting the ZEGO team. |
AuthInfo | string | Yes | Encrypted data, device-related identifiers generated by the SDK, which can be obtained by calling the getAuthInfo method. |
curl -X GET --data https://aieffects-api.zego.im?Action=DescribeEffectsLicense&AppId=xxxxxxxx&AuthInfo=xxxxxxxx
Your business server constructs a message body through the public gateway interface and directly sends a request to the ZegoEffects Server to apply for an license file. The message body structure is as follows:
Parameter | Type | Required | Description |
---|---|---|---|
AppId | unsigned int | Yes | The unique identifier of the user privilege authentication, which can be obtained by contacting the ZEGO team. |
Signature | string | Yes | The API request signature. For more details, see Signing the requests. |
SignatureNonce | string | Yes | A random string. |
SignatureVersion | string | Yes | The version of the signature. Default value: 2.0. |
Timestamp | string | Yes | Unix timestamp in seconds. A maximum error of 10 minutes is allowed. |
curl -X GET https://aieffectscgi-api.zego.im?Action=CgiDescribeEffectsLicense?AppId=1&Signature=1302668869d55ab3f6114af4ba6e5580&SignatureNonce=3f15d0b95f6e480b&SignatureVersion=2.0&Timestamp=1635940599
The following is the sample message returned by the ZegoEffects Server:
{
"Code": 0,
"Message": <message>,
"Data": {
"License": <license>
}
}
License
field.Code
returns an error code, and the Message
is the corresponding error message.The code
value in the returned filed varies based on the online authentication methods:
Parameter | Type | Description | |
---|---|---|---|
Code |
unsigned int32 |
When you send the request from the app client, the error code returned is as follows:
|
When you send the request from the business server the error code returned is as follows:
|
Message |
string |
The returned message corresponds to the Code value. |
|
Data |
object |
The license file is returned when Code is 0. |
Among which, the returned field Data:
Parameter | Type | Description |
---|---|---|
License | string | Contains the license file. |
To activate the features you want, you need to import the license file to the ZegoEffects SDK
.
To import the license file, do the following:
Data
> License
.create
method, pass the license file to the ZegoEffects SDK
.ZegoEffects SDK
object.// Before create a ZegoEffects SDK obejct, call the setResources method and import related resources and models.
// Pass the license file, create a ZegoEffects SDK object.
String license = "xxxxxxx";
ZegoEffects mEffects = ZegoEffects.create(license, applicationContext);
Before you create a ZegoEffects SDK
object (create
), you will need to import the resources and models (setResources
) first.