All Templates / Authentication

Agora Token Deployment

Agora Token Deployment

Token generator for Agora RTM, Video SDK, and Chat.

Deploy Agora Token Deployment

agora-token-service

AgoraIO-Community/agora-token-service

Just deployed

Agora Token Service

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.

getToken API Endpoint

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.

Endpoint URL

POST /getToken

Request Body

To generate tokens, the request body should contain a JSON payload with specific parameters based on the token type:

  1. RTC Token:

    • tokenType: "rtc"
    • channel: Your channel name.
    • role: "publisher" or "subscriber."
    • uid: Your unique identifier.
    • expire (optional): Expiration time in seconds (default: 3600).
  2. RTM Token:

    • tokenType: "rtm"
    • uid: Your unique identifier.
    • channel (optional): Stream channel (wildcard "*" is an option).
    • expire (optional): Expiration time in seconds (default: 3600).
  3. Chat Token:

    • tokenType: "chat"
    • uid (optional): User-specific chat token.
    • expire (optional): Expiration time in seconds (default: 3600).

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.

Sample Usage

Here's an example of how to use the getToken API endpoint with a POST request using cURL:

Request:

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

Deploy Now

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

View Template
Keycloak

Keycloak

Keycloak template with keywind theme + apple and discord providers


View Template
Authorizer

Authorizer

Open-source authentication and authorization solution for your business.


Lakhan Samani

View Template
Supabase Auth

Supabase Auth

Authentication and User Management by Supabase


Bert