Server-side Token Generation

Hey guys,

I have a question regarding the Vivox docs and their example code they use for server-side token generation (see below). Specifically, for the “claims” variable,

  • Is the “iss” entry the actual issuer id (like “12345-gamename_-67891-udash”, for example)?
  • What are the possible values for the “vxa” entry?
  • For the “f” and “t” entries, do I keep those same formats, and just replace username with the player’s name, and channelname with the channel name?
  • If I’m just logging in (not joining yet), what do I put fur the “t” entry (since I don’t have a channel name yet when logging in)?

Hi,

I will answer most of your questions here, but these answers and more can be found in our Access Token Developer’s Guide.

Yes, in the code sample “issuer” would be replaced with the actual issuer credential. See Access token payload for more information.

Rather than listing them here, please see Supported values for the Vivox action claim for the list.

Yes, the formats would be similar. For usage for “f” and “t” please see some of our examples:

Depending on what operation you are performing, some values are not needed. For example on the Example: Login token page you can see that “t” is not provided.

1 Like

Thank you for the detailed reply and the links!!!
Much appreciated.

Hi @dylan_unity3d ,

So the login method works, but the joining fails.
I followed exactly the formatting as detailed here: Join Token

What happens is that it starts connecting, and then immediately disconnects through my OnChannelSessionConnectionStateChanged event (as shown below). I then get this warning:

VivoxCore: Warning: req_sessiongroup_remove_session failed for 1001:Target Object Does Not Exist

Note that when I use
ChannelSession.GetConnectToken(VIVOX_VOICE_TOKEN_KEY, TokenExpiration); (with a hard-coded key), joining is always successful

Also, I actually took the example in Join Token, ran it through my javascript server code, and it returned the exact token that the example prints. So the server code seems to work.
So why is joining failing?

My join payload looks like this:

9775137--1401504--upload_2024-4-17_16-27-2.png

Are you trying to join a positional or non-positional channel?

Can you please DM me the unredacted version of that payload image and also the fully channel ID using the ToString() method on the channel object.

Ok, DM’ed you.

Yes, the issue is what I thought. You are using a positional channel, but you are not including the positional parameters in the VAT. The value in the “t” must be identical to the channel ID.

For example, if your channel is:
sip:confctl-d-12345-abcd_-56789-udash.testChannel!p-8100-2000-1.000-2@mtu1xp.vivox.com
then that is the value for the “t” parameter. If there is a difference of even 1 character, the channel is not the same as what you are joining and the VAT will not work.

Please let me know if this solves your issue.

1 Like

Aha, ok got it!
Thanks again!