Documentation

Support

Vivox Unreal SDK

Vivox Unreal SDK

Unity Authentication Service in Unreal

Understand how to use Unity Authentication Service with Vivox in Unreal.
Read time 2 minutesLast updated 2 days ago

You can use the Unity Authentication Service (UAS) in your Unreal Vivox application.

Requirements

Integration steps

  1. Ensure you have a compatible version of the Unreal Engine for the Unity Gaming Services for Unreal Plugin. Refer to the SDK page in the Unreal Marketplace for more information.
  2. Go to the Unity Gaming Services SDK for Unreal Engine Unreal Engine Marketplace page in your Epic Games Launcher, or select Open in Launcher from the linked Marketplace page.
  3. Load the plug-in into your project on the Epic Games Launcher Marketplace page.
  4. Go into your Project Settings and locate the Unity Authentication plug-in settings.
  5. Place the Project ID from your Project page on the Unity Dashboard into the Project ID field. The setting will likely autoformat. Place the target environment name in the Environment Name field.

Authenticate with the Unity Authentication Service

Use the following instructions to set up the Unity Authentication Subsystem to sign-in to Vivox:
  1. Add Authentication to the PublicDependencyModuleName in your project’s build.cs file
    • Once you install the plug-in and assign settings in your project, you can set up and une the
      AuthenticationSubsystem
      in C++.
  2. Get the UGameInstance from the GameWorld and assign the AuthenticationSubsystem to a variable from the GameInstance.
    UWorld* GameWorld = GetWorld();UGameInstance* GameInstance = GameWorld->GetGameInstance();UAuthenticationSubsystem* AuthenticationSubsystem = GameInstance->GetSubsystem<UAuthenticationSubsystem>();
  3. Set up an
    AuthenticationResponse
    UFunction, named
    OnAuthentication
    in the following example, to track when the Authentication has finished successfully. Then, pass it into SignInAnonymously, along with any
    FAuthenticationSignInOptions
    you need.
    Unity::Services::Core::THandler<FAuthenticationResponse> authenticationResponse;FName OnAuthenticationFName("OnAuthentication");authenticationResponse.BindUFunction(this, OnAuthenticationFName);FAuthenticationSignInOptions signInOptions;AuthenticationSubsystem->SignInAnonymously(signInOptions, authenticationResponse);
  4. After Authentication has successfully authenticated to the UGS Service, replace the LoginToken in any
    LoginSession.BeginLogin
    call with the AuthenticationSubsystem->GetAccessToken(). Below is an example:
    LoginSession.BeginLogin(WebService, AuthenticationSubsystem->GetAccessToken(), SubscriptionMode::Accept, TSet<AccountId>(), TSet<AccountId>(), TSet<AccountId>(), OnBeginLoginCompleteCallback);
    //This is being done in OnAuthentication, using the returned FAuthenticationResponse as responseAccountId m_Account = AccountId(m_tokenIssuer, response.UserId, m_domain)
You can also use Authentication Tokens in place of
ChannelSession
connect tokens, as shown in the following example:
ChannelSession.BeginConnect(true, false, true, AuthenticationSubsystem->GetAccessToken(), OnBeginConnectCompleteCallback);