Overview
Ant Media Server supports multiple authentication mechanisms:- One-time tokens - Random tokens with expiration
- JWT tokens - Industry standard JSON Web Tokens
- TOTP - Time-based One-Time Passwords for subscribers
Generate One-Time Token
Generate a random one-time token for a specific stream.GET /v2/broadcasts/{id}/token
Stream ID to generate token for
Token expiration time in Unix timestamp (seconds)
Token type:
publish or playRoom ID if token is for a conference room
Generated token ID
Stream ID this token is valid for
Token expiration timestamp
Token type (publish/play)
Generate JWT Token
Generate a JWT token for a stream. Generally JWT tokens should be generated on the client side.GET /v2/broadcasts/{id}/jwt-token
Stream ID to generate JWT token for
Token expiration time in Unix timestamp (seconds)
Token type:
publish or playRoom ID if token is for a conference room
Validate Token
Validate if a token is still valid and not expired.POST /v2/broadcasts/validate-token
Token ID to validate
Stream ID associated with the token
Token expiration timestamp
Token type (publish/play)
true if token is valid, false otherwiseList Tokens
Get all tokens for a specific stream.GET /v2/broadcasts/{id}/tokens/list/{offset}/{size}
Stream ID to list tokens for
Starting point of the list
Number of tokens to return (max: 50)
Revoke All Tokens
Remove all tokens associated with a stream.DELETE /v2/broadcasts/{id}/tokens
Stream ID to revoke tokens for
true if tokens were revoked successfullyTOTP Authentication
For subscriber-based authentication, Ant Media Server supports Time-based One-Time Passwords (TOTP).Get TOTP for Subscriber
GET /v2/broadcasts/{id}/subscribers/{subscriberId}/totp
Stream ID
Subscriber ID to generate TOTP for
Type:
publish or play. Used if subscriber is not in databaseIndicates if TOTP was generated successfully
The generated TOTP code (6 digits)
How TOTP Works
If the subscriber is registered in the database with ab32Secret:
- TOTP is generated using the subscriber’s secret
- Custom expiry period is used if set, otherwise global setting applies
- Secret is generated from AppSettings:
{secretFromSettings} + {subscriberId} + {streamId} + {type} + {padding} - Uses global
timeTokenPeriodsetting
Subscriber Authentication Token
Get a JWT authentication token for a subscriber (for push notifications).GET /v2/push-notification/subscriber-auth-token
Subscriber ID to generate token for
Token validity duration in seconds (default: 3600)
Whether token generation succeeded
The generated JWT token
Description of the response
