인터페이스 구현 기반 토큰 생성
How to generate access tokens using an interface implementation.
읽는 시간 1분최근 업데이트: 19일 전
VAT(Vivox 액세스 토큰) 생성 방법을 제어하려면 Vivox SDK의
IVivoxTokenProviderVivoxService.Instance.SetTokenProviderIVivoxTokenProvider.GetTokenAsyncIVivoxTokenProvider.GetTokenAsyncIVivoxTokenProvider.GetTokenAsync구독하기
다음과 같이IVivoxTokenProviderVivoxService.Instance.SetTokenProvider(new CustomTokenProvider());
토큰 가져오기
일부가 비어 있더라도 오버라이드된 메서드에 제공된 모든 파라미터를 사용하여 페이로드를 생성하고 이를 보안 서버로 보내 Vivox 액세스 토큰을 생성합니다. 가장 좋은 방법은 모든 파라미터를 보내는 것입니다. 페이로드에 필요한 것만 반환됩니다. 페이로드를GetTokenAsync이 특정 플로에 대한 자세한 내용은 Vivox 액세스 토큰으로 로그인을 참고하시기 바랍니다. 서버 측 토큰 생성에 대한 자세한 내용은 보안 서버에서 토큰 생성을 참고하시기 바랍니다.public class VoiceManager : MonoBehaviour{ async void Start() { // Must be done before any other Vivox action otherwise tokens will not be generated properly. VivoxService.Instance.SetTokenProvider(new VivoxTokenProvider()); await UnityServices.InitializeAsync(); await VivoxService.Instance.InitializeAsync(); }}class VivoxTokenProvider : IVivoxTokenProvider{ public Task<string> GetTokenAsync(string issuer = null, TimeSpan? expiration = null, string targetUserUri = null, string action = null, string channelUri = null, string fromUserUri = null, string realm = null) { // Implement token fetching logic here. // The method parameters contain the necessary information for crafting the request payload. // This will be called whenever a token is needed for a Vivox action }}