Generate a token on the client
Generate Vivox Access Tokens on the client.
阅读时间1 分钟最后更新于 3 天前
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);