Skip to main content

Agora Token Generator

Description

Token generator for building a token server with Python & the Agora RTM/RTC

Installation


pip install agora-token-builder

Usage


RTC Live Video Calling & Chat SDK

Build token with int UID:

from agora_token_builder import RtcTokenBuilder

#Build token with uid
token = RtcTokenBuilder.buildTokenWithUid(appId, appCertificate, channelName, uid, role, privilegeExpiredTs)

Build token with string UserAccount:

from agora_token_builder import RtcTokenBuilder

#Build token with userAccount
token = RtcTokenBuilder.buildTokenWithAccount(appId, appCertificate, channelName, account, role, privilegeExpiredTs)
RTM Real-Time Messaging & Chat SDK

Build RTM token.

from agora_token_builder import RtmTokenBuilder

token = RtmTokenBuilder.buildToken(appID, appCertificate, userAccount, role, privilegeExpiredTs)

Variable Definitions

appID
The App ID issued to you by Agora. Apply for a new App ID from the gora Dashboard if it is missing from your kit. See Get an App ID.

appCertificate
Certificate of the application that you registered in the Agora Dashboard. See Get an App Certificate.

channelName
Unique channel name for the AgoraRTC session in the string format

uid
User ID. A 32-bit unsigned integer with a value ranging from 1 to (232-1). optionalUid must be unique.

userAccount A unique identifier used for to represent a user account. This value will be a string and can contain numbers, letters and any special characters.

role
Role_Publisher = 1: A broadcaster (host) in a live-broadcast profile. Role_Subscriber = 2: (Default) A audience in a live-broadcast profile.

privilegeExpireTs
Represented by the number of seconds elapsed since 1/1/1970. If, for example, you want to access the Agora Service within 10 minutes after the token is generated, set expireTimestamp as the current

License

© 2021 Agora.io

This repository is licensed under the MIT license. See LICENSE for details.

Metadata

Release files for agora-token-builder 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agora-token-builder 1.0.0
File Size Uploaded
agora_token_builder-1.0.0.tar.gz 4.8 kB Details

Release files / agora_token_builder-1.0.0.tar.gz

Download URL agora_token_builder-1.0.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6a22a35baf748dc80ca054ba7e293ba16c22dc7eae85396ffb41e80f13f9c2f1
BLAKE2b-256 checksum
How to use checksums
b9556741101e6169f7c44388f1184b845db956ccfaac23356f49077418042885
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page