...
There are four types of tokens for publishing and streaming:
Token Type | Permits | Include in Call to Create |
---|---|---|
authToken | Creation of a session | forAuthenticationOnly() |
streamToken | Consumption of a stream | forStreamingOnly() |
publishToken | Creation of a stream | forPublishingOnly() |
edgeToken (is both an authToken and a streamToken) | Creation of a session and consumption of streams | default / none |
All that is needed for playback or publishing is a token from the EdgeAuth library, and all that is needed to generate that token is the App ID and Secret, as well as information about the Channel or Room. You do not need any user information unless you (optionally) want to restrict the token based on user information, e.g., to a particular session ID. See below for details about restricting tokens.
...
Tokens are evaluated when presented to the platform, such as when the SDK attempts to authenticate initially, or following an extended network interruption. If the token has expired, the session will not be authenticated and the application will need to obtain another token.
Note |
---|
Tokens cannot be directly invalidated once created. Phenix advises caution when creating long-lived tokens. If tokens were created based on the Channel ID (as is the default for tokens created using the Portal), you can indirectly invalidate them by deleting the Channel and then creating a new Channel with the same name and alias. The new Channel will have a new Channel ID and the old tokens associated with the old Channel ID will no longer work for the new Channel. If tokens were created based on the Channel Alias, this technique will not work; that is, the tokens will remain valid after deleting and re-creating the Channel. |
SDK Initialization with AuthToken
The use of an AuthToken when initializing the SDK varies based on the API Level and client platform. These are summarized in the following table.
Platform | PCastExpress | RoomExpress | ChannelExpress |
Web | sdk.express.PCastExpress(authToken) | sdk.express.RoomExpress(authToken) | sdk.express.ChannelExpress(authToken) |
Android | PCastExpressFactory.createPCastExpress(pcastExpressOptions); | RoomExpressFactory.createRoomExpress(roomExpressOptions); | ChannelExpressFactory.createChannelExpress(channelExpressOptions); |
iOS | PhenixPCastExpressFactory.createPCastExpress(pcastExpressOptions) | PhenixRoomExpressFactory.createRoomExpress(roomExpressOptions); | PhenixChannelExpressFactory.createChannelExpress(channelExpressOptions); |