Generate a token on the client
Generate Vivox Access Tokens on the client.
Read time 1 minuteLast updated 2 days ago
Important: Use the following access token generation methods during initial development and prototyping. Do not include this method of generation in production builds of your game. Allowing token generation on the client during production is both a security risk and can cause unexpected token expiration errors for your users. The following APIs are available to generate insecure access tokens from the client for use during early development:
- IChannelSession::GetConnectToken()
- IChannelSession::GetTranscriptionToken()
- ILoginSession::GetLoginToken()
- IParticipantProperties::GetMuteForAllToken()
- The token signing key
- The token time to live in seconds
const TCHAR *kKey = TEXT("demo-key");const FTimespan kExpiration = FTimespan::FromSeconds(90);// Login (This assumes an already initialized Client object)ILoginSession &loginSession(client.GetLoginSession(/* Account to login */));loginSession.GetLoginToken(kKey, kExpiration);// Join (This assumes an already signed in ILoginSession object)IChannelSession &channelSession(loginSession.GetChannelSession(/* ChannelId to join*/));channelSession.GetConnectToken(kKey, kExpiration);// Mute (This assumes an already signed in ILoginSession object joined to a Connected IChannelSession)IChannelSession &channelSession(loginSession.GetChannelSession(/* ChannelId to mute in*/));IParticipant &participant(channelSession.Participants()[ParticipantKey]);participant.GetMuteForAllToken(kKey, kExpiration);// Transcription (This assumes an already signed in ILoginSession object joined to a Connected IChannelSession)IChannelSession &channelSession(loginSession.GetChannelSession(/* ChannelId to begin transcribing*/));channelSession.GetTranscriptionToken(kKey, kExpiration);