Skip to content

A backend service for generating and managing time-bound Agora RTC tokens to authenticate users in video/voice calls. Ensures secure, role-based access with dynamic token expiration and channel validation.

Notifications You must be signed in to change notification settings

ZakirCodeArchitect/SRC-Token-server-for-Agora

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agora RTC Token Server

This server generates secure Agora RTC tokens for video calling applications. It ensures secure authentication, role-based permissions, and token expiration.


Table of Contents

  1. Features
  2. Setup Instructions
  3. Installation
  4. API Endpoints
  5. Role-Based Permissions
  6. Logging
  7. Rate Limiting
  8. Error Handling
  9. Sample Integration
  10. Support

Features

  • Secure Authentication: Only authorized users can generate tokens.
  • Token Expiration: Tokens expire after 10 hours to prevent misuse.
  • Role-Based Permissions: Differentiates between host (publisher) and subscriber (consumer) roles.
  • Dynamic Token Generation: Generates tokens on-demand for each request.
  • Logging: Logs requests and errors to files.
  • Rate Limiting: Limits requests to 100 per 15 minutes per IP address.

Setup Instructions

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local or cloud-based)
  • Agora App ID and Certificate (from the Agora Console)

Steps

  1. Clone the Repository:
    git clone https://github.com/ZakirCodeArchitect/SRC-Token-server-for-Agora.git
    cd nodejs-agora-token-server-example
    
  2. Installations
    npm install
    
  3. Setup .env file
    APP_ID=YOUR_APP_ID
    APP_CERTIFICATE=YOUR_APP_CERTIFICATE
    API_SECRET_KEY=YOUR_SECRET_KEY
    MONGODB_URI=mongodb://localhost:27017/agora
    
  4. Start server
    npm start
    
  5. API Endpoints
    curl -X GET "http://localhost:3000/token-rtc?channelName=test&uid=1234" \
    -H "Authorization: YOUR_SECRET_KEY"
    
    curl -X GET "http://localhost:3000/host-action?uid=1234" \
    -H "Authorization: YOUR_SECRET_KEY"
    
    curl -X GET "http://localhost:3000/subscriber-action?uid=5678" \
    -H "Authorization: YOUR_SECRET_KEY"
    

About

A backend service for generating and managing time-bound Agora RTC tokens to authenticate users in video/voice calls. Ensures secure, role-based access with dynamic token expiration and channel validation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%