Before using an Agora RESTful API, you need to setup REST authentication.
Available REST authentication methods are:
Basic HTTP authentication
You need to generate a Base64-encoded credential with the Customer ID and Customer Secret provided by Agora and pass the credential to the
Authorizationparameter in the request header.
Implement authentication on the server; otherwise, you may encounter the risk of data leakage.
To generate a set of Customer ID and Customer Secret, do the following:
In Agora Console, click the account name in the top right corner, and click RESTful API from the drop-down list to enter the RESTful API page.
Click Add a secret, and click OK. A set of Customer ID and Customer Secret is generated.
Click Download in the Customer Secret column. Read the pop-up window carefully, and save the downloaded
key_and_secret.txtfile in a secure location.
Use the Customer ID (key) and Customer Secret (secret) to generate a Base64-encoded credential, and pass the Base64-encoded credential to the
Authorizationparameter in the HTTP request header.
You can download the Customer Secret from Agora Console only once. Be sure to keep it secure.
The following sample codes implement basic HTTP authentication and send a request with the Server RESTful API to get the basic information of all current Agora projects.