Consult with the Treasure team to gain access to a pre-release version of the Treasure Launcher.

Games that are distributed via the Treasure Launcher, do not need to authenticate users via the Treasure Connect flow.

The UE5 TDK will automatically detect if the user is using the Treasure Launcher and provides the developer with access to the user’s auth token.

The auth token can be used to interact with the TDK API.

C++ Integration

Public members

static FString GetTDKAuthToken();

bool StartTDKSession(
    TDK::LauncherModels::FStartSessionRequest Request,
    const FStartSessionBatchDelegate& SuccessDelegate = FStartSessionBatchDelegate(),
    const FTDKErrorDelegate& ErrorDelegate = FTDKErrorDelegate(),
);

struct TDKCPP_API FStartSessionRequest : public FTDKCppRequestCommon {
    FString BackendWallet;
    TArray<FString> ApprovedTargets;
    int64 NativeTokenLimitPerTransaction;
    int32 SessionDurationSec;
    int32 SessionMinDurationLeftSec;
}

Usage Example

  • Get the auth token
#include "TDKCommonUtils.h"

FString authToken = TDKCommon::TDKCommonUtils::GetTDKAuthToken();
  • Start a user session via the Treasure Launcher
#include "TDKCpp.h"
#include "Core/TDKError.h"
#include "Core/TDKLauncherDataModels.h"
#include "Core/TDKLauncherAPI.h"

TDKLauncherPtr LauncherPtr = ITDKCppModuleInterface::Get().GetLauncherAPI();

TDK::LauncherModels::FStartSessionRequest Request;
LauncherPtr->StartTDKSession(
    Request,
    TDK::UTDKLauncherAPI::FStartSessionBatchDelegate::CreateUObject(this, &ALauncherAPITest::OnSuccess),
    TDK::FTDKErrorDelegate::CreateUObject(this, &ALauncherAPITest::OnError));

/* * * * */

void ALauncherAPITest::OnSuccess(const TDK::LauncherModels::FStartSessionResponse& Result) const
{
	UE_LOG(LogTemp, Warning, TEXT("Congratulations, you made your first successful Analytics API call!"));

	UE_LOG(LogTemp, Warning, TEXT("Request Result: %s"), Result.Result ? TEXT("true") : TEXT("false"));
}

void ALauncherAPITest::OnError(const TDK::FTDKCppError& ErrorResult) const
{
	UE_LOG(LogTemp, Error, TEXT("Something went wrong with your API call.\nHere's some debug information:\n%s"), *ErrorResult.GenerateErrorReport());
}

Unreal Blueprints Integration

  • Make StartSessionRequest

  • Start Session

  • Get Auth Token