DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnGetTicket, int32, LocalUserNum, FString, TokenData);
+UFUNCTION(BlueprintCallable)
+static void GetSteamAuthTicket(int32 LocalUserNum, FOnGetTicket Callback)
+{
+ //Get the steam subsystem
+ FOnlineSubsystemSteam* SteamSubsystem = static_cast<FOnlineSubsystemSteam*>(IOnlineSubsystem::Get());
+ //Add a handler to the subsystem for when the ticket has been retrieved
+ SteamSubsystem->GetEncryptedAppTicketInterface()->OnEncryptedAppTicketResultDelegate.AddLambda(
+ [LocalUserNum, OnComplete = Callback](bool bEncryptedDataAvailable, int32 ResultCode) {
+
+ TArray<uint8> TokenData;
+ if (bEncryptedDataAvailable)
+ {
+ //If the ticket was retrieved successfully, get its data
+ SteamSubsystem->GetEncryptedAppTicketInterface()->GetEncryptedAppTicket(TokenData);
+ }
+ //Call the user callback with the base64-encoded ticket, ready for submission via AuthenticateUserExternalAsync
+ OnComplete.ExecuteIfBound(LocalUserNum, FBase64::Encode(TokenData));
+ });
+ //Begin the actual async request for the ticket, which will invoke the above lambda when it completes
+ SteamSubsystem->GetEncryptedAppTicketInterface()->RequestEncryptedAppTicket(nullptr, 0);
+}
+Note that if you are on 4.27 or above, Epic provides a helper method in OnlineIdentityInterface::GetLinkedAccountAuthToken that will get the current account’s auth token without having to take a direct dependency on FOnlineSubsystemSteam. Ensure that the token is Base64 encoded when being passed to AuthenticateUserExternalAsync.
+