What is a Token? Where can I get a Token? When shall I use it?
Products / Plugins:Video Call / Voice Call / Live Streaming
Platform / Framework:iOS / Android / macOS / Windows
Last updated:2022-04-01 15:00
This document is for reference on iOS, Android, macOS, and Windows.
What is a Token?
A Token, also known as a dynamic key, is used in situations requiring high security. You will need a Token for user identity and user privilege authentication when logging in to a room or when publishing streams in a room.
Before using this feature, contact ZEGOCLOUD technical support to enable it first.
Generate and use a Token
After enabling the user privilege control feature, you must generate a Token on a business server and pass the Token when logging in to a room. And ZEGO validates the room login privilege and stream publishing privilege based on the Token you passed.
For more details, see Video Call - Use Tokens for authentication.
Expiration period of a Token
The validity period is when the Token itself expires, you can set the expiration period by yourself. For more details, see chapter 4.1 Generate a Token in Video Call - Use Tokens for authentication.
SDK behaviors when a Token expires
Users won't be kicked out of the room immediately when their Token expires, and the streams they have published also won't be affected. But they will not be able to log in to the room and publish streams next time.
Therefore, when notified that your Token will soon expire or that the Token validity has expired, generate a new Token at your earliest convenience by calling the renweToken
method provided by the ZEGO SDK.
API reference:
- iOS:
renewToken
- Android:
renewToken
- macOS:
renewToken
- Windows:
renewToken