Integrate an existing project using VATs with Unity Authentication

If you already have a Vivox integration that's using VATs for players to join channels and interact with Vivox, you can use this guide to integrate with UAS to access the full suite of services Unity provides.

You will have to make some changes to the player sign-in flow and the VAT creation flow.

Overall, the two flows will work like this:

A flow diagram showing the player sign in process between the game client, game back end, and Unity Authentication services. The second flow shows the token process of requesting a VAT from the game back end, token validation done by UAS and being sent back to the game back end before being returned to the game client.

Sign In

  1. Register all users with the UAS custom ID provider on sign-in and retrieve accessToken and sessionTokens for players.
  2. Set up the AuthenticationService in the client using the accessToken and sessionToken

Important: You might not need to use VATs at all. VATs are only needed if you have custom logic in your backend to determine if a player is allowed to access a specific channel. If this is not the case, you can simply remove the VAT generation flow and let the Unity Authentication SDK handle it. Simply use the default initialization for Vivox: await VivoxService.Instance.InitializeAsync(); and skip the Creating VATs step.

Creating VATs

  1. The Vivox SDK will request a VAT from the backend whenever one is needed using a custom token provider implementation.
  2. Add the accessToken to the request to the backend when requesting VATs within the GetTokenAsync method.
  3. Validate and extract the needed information from the token in the backend and create the Vivox Access Token to send it back to the client.

Steps

Follow these tutorials to update your sign-in and VAT creation flows.

1. Update sign-In flow

To set up the custom ID sign-in, follow the steps in Sign-in with Custom IDs.

2. Update VAT creation flow

To adapt your VAT creation flow to integrate with UAS, follow the steps in Using Vivox Access Tokens together with UAS.

With all of this done, you are now ready to use any of the Unity Gaming Services, including the Vivox Moderation Platform.