Agora Token Deployment
Token generator for Agora RTM, Video SDK, and Chat.
agora-token-service
AgoraIO-Community/agora-token-service
Just deployed
Deploy and Host Agora Token Service on Railway
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.
About Hosting Agora Token Service
Hosting an Agora Token Service means running a web API that generates authentication tokens for Agora's real-time communication services. The service handles token generation requests and returns secure tokens with configurable expiration times for RTC, RTM, and Chat features. Production deployment requires managing sensitive Agora API credentials, implementing request validation, and ensuring secure token distribution across environments. Railway handles the deployment complexity by managing environment variables for Agora credentials, providing secure API hosting, and automating the service routing with built-in parameter validation and standardized response formatting.
Common Use Cases
- Real-Time Communication Apps: Generate tokens for video calling, voice calling, and live streaming applications using Agora Video SDK
- Messaging Applications: Create RTM tokens for real-time messaging and chat functionality integration
- Multi-Service Platforms: Centralized token generation for applications using multiple Agora services simultaneously
Dependencies for Agora Token Service Hosting
The Railway template includes the required web framework and Agora SDK dependencies for token generation.
Deployment Dependencies
Implementation Details
getToken API Endpoint:
The getToken API endpoint enables you to generate tokens for different application features through HTTP POST requests to /getToken
.
Token Types Supported:
RTC Token:
tokenType
: "rtc" for real-time communicationchannel
: Your channel namerole
: "publisher" or "subscriber"uid
: Your unique identifierexpire
(optional): Expiration time in seconds (default: 3600)
RTM Token:
tokenType
: "rtm" for real-time messaginguid
: Your unique identifierchannel
(optional): Stream channel (wildcard "*" is an option)expire
(optional): Expiration time in seconds (default: 3600)
Chat Token:
tokenType
: "chat" for chat servicesuid
(optional): User-specific chat tokenexpire
(optional): Expiration time in seconds (default: 3600)
API Response:
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.
Request Processing:
To generate tokens, the request body should contain a JSON payload with specific parameters based on the token type. The service validates request parameters, generates appropriate tokens using Agora SDK methods, and returns formatted responses with proper error handling.
Why Deploy Agora Token Service on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Agora Token Service on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
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