Hello,
I am currently using vivox sdk version 15.1.200000-pre.1 with Unity 2021.3.21f1. My project is linked with unity dashboard and I am not using test mode (mtu1xp backend is being used. Also not using unity authentication package).

I want to use server generated token. So I generated my VAT token in my server & used it in my client project. It worked & I thought I successfully logged in using my server generated login token. Then instead of my server generated token I used -
- Case 1: Empty string.
- Case 2: Random string like - “Hello World” or “I am Token”
In case of “Case 1”, I got an error while trying to login as expected.
But in case of “Case 2”, I successfully logged in to vivox even joined a channel the same way which was not suppose to. If “Case 2” is working then the whole process of token generation doesn’t make any sense. I even checked my dashboard. It also shows that I successfully logged in. (Attaching an image with dashboard vivox login data. Red marked area is with random string.)
Now I am confused why it is working successfully without properly generated access token. Am I missing any necessary step? Is vivox somehow still generating test token if it finds invalid token internally? I am providing my code below.
[SerializeField] private VivoxClientCredentials _credentials; //scriptable object with my dashboard credential
private Client _client;
private AccountId _accountId;
public async Task InitializeUnityServices()
{
var options = new InitializationOptions();
options.SetVivoxCredentials(_credentials.Server, _credentials.Domain, _credentials.Issuer);
await UnityServices.InitializeAsync(options);
Debug.Log("Unity services initialized");
}
public async Task Initialize()
{
if(VivoxService.Instance.Client != null && VivoxService.Instance.Client.Initialized)
{
return;
}
await InitializeUnityServices();
VivoxService.Instance.Initialize();
_client = VivoxService.Instance.Client;
Debug.Log("Vivox client initialized");
}
public async void LoginVivox(string userId, string username)
{
try
{
if(_loginSession != null && _loginSession.State == LoginState.LoggedIn)
{
return;
}
await Initialize();
_accountId = new AccountId
(
VivoxService.Instance.Issuer,
userId,
VivoxService.Instance.Domain,
username,
null,
VivoxService.Instance.EnvironmentId
);
string accessToken = await GetVivoxLoginTokenFromMyServerAsync(); //My server generated token
_vivoxLogin.Login(_client.GetLoginSession(_accountId), new Uri(_credentials.Server), accessToken);
}
catch (Exception ex)
{
Debug.LogError(ex);
}
}
public void Login(ILoginSession loginSession, Uri serverUri, string accessToken)
{
if (loginSession == null || serverUri == null))
{
return;
}
loginSession.PropertyChanged += LoginSession_PropertyChanged;
loginSession.BeginLogin(serverUri, accessToken , ar =>
{
try
{
loginSession.EndLogin(ar);
}
catch (Exception e)
{
// Handle error
Debug.LogError(nameof(e));
// Unbind if we failed to login.
loginSession.PropertyChanged -= LoginSession_PropertyChanged;
}
});
}
private void LoginSession_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
var loginSession = (ILoginSession)sender;
if (e.PropertyName == "State")
{
switch(loginSession.State)
{
case LoginState.LoggingIn:
Debug.Log("Trying to login vivox.");
break;
case LoginState.LoggedIn:
Debug.Log("Logged in to the vivox.");
break;
case LoginState.LoggingOut:
Debug.Log("Trying to logout vivox.");
break;
case LoginState.LoggedOut:
Debug.Log("Logged out of the vivox.");
break;
default:
Debug.Log("Something went wrong while trying to log in to the vivox.");
break;
}
}
}
In case of “Case 2” I get “logged in to vivox.” every time. I donno why. It’s possible I missed something but donno what.
