All Templates / Authentication
Agora Token Deployment
Token generator for Agora RTM, Video SDK, and Chat.
agora-token-service
AgoraIO-Community/agora-token-service
Just deployed
The Agora Token Service is a convenient utility for generating tokens required for various functionalities of the application, including Agora Real-Time Messaging (RTM), Video SDK, and Chat services. This service simplifies the token generation process and provides an easy-to-use API.
The getToken
API endpoint enables you to generate tokens for different application features. This section outlines how to utilize the getToken
endpoint through HTTP POST requests.
POST /getToken
To generate tokens, the request body should contain a JSON payload with specific parameters based on the token type:
RTC Token:
tokenType
: "rtc"channel
: Your channel name.role
: "publisher" or "subscriber."uid
: Your unique identifier.expire
(optional): Expiration time in seconds (default: 3600).RTM Token:
tokenType
: "rtm"uid
: Your unique identifier.channel
(optional): Stream channel (wildcard "*" is an option).expire
(optional): Expiration time in seconds (default: 3600).Chat Token:
tokenType
: "chat"uid
(optional): User-specific chat token.expire
(optional): Expiration time in seconds (default: 3600).Upon successful token generation, the API responds with an HTTP status code of 200 OK
. The token is included in the response body with the key "token"
.
In case of errors or invalid request parameters, the API provides an appropriate HTTP status code along with an error message in the response body.
Here's an example of how to use the getToken
API endpoint with a POST request using cURL:
curl -X POST -H "Content-Type: application/json" -d '{
"tokenType": "rtc",
"channel": "my-video-channel",
"role": "publisher",
"uid": "user123",
"expire": 3600
}' "https://your-api-domain.com/getToken"
Response:
{
"token": "your-generated-token-here"
}
Template Content
agora-token-service
AgoraIO-Community/agora-token-serviceAPP_ID
Login to the Agora.io Developer Dashboard (http://dashboard.agora.io), and navigate to the "Projects" tab to get this value.
APP_CERTIFICATE
Login to the Agora.io Developer Dashboard (http://dashboard.agora.io), and navigate to the "Projects" tab to get this value
Details
Max Cobb
Created on Oct 24, 2022
1144 total projects
991 active projects
100% success on recent deploys
Go, Dockerfile
Authentication
More templates in this category
Authorizer
Open-source authentication and authorization solution for your business.
Lakhan Samani
552