I’ve gone and setup login code to work with the Dev Auth Tool. Yes I setup a connection in the tool and as you can see I’ve used the localhost IP and the token name that I setup in the tool as well. Then on the PlayerController BeginPlay method I call my login method. But no matter what I get the login failure message with the message invalid parameters. The Dev Auth Tool is running when I run my game.
Here’s the Login method found in a GameInstanceSubsystem:
void UMySubsystem::Login()
{
using namespace UE::Online;
UE::Online::IOnlineServicesPtr OnlineServices = UE::Online::GetServices();
UE::Online::IAuthPtr AuthInterface = OnlineServices->GetAuthInterface();
FAuthLogin::Params LoginParams;
LoginParams.CredentialsType = LoginCredentialsType::Developer;
LoginParams.CredentialsId = TEXT("127.0.0.1:8080");
LoginParams.CredentialsToken.Emplace<FString>("MyTokenName");
AuthInterface->Login(MoveTemp(LoginParams)).OnComplete([](const TOnlineResult<FAuthLogin>& Result)
{
if (Result.IsOk())
{
UE_LOG(LogOnlineSubsystem, Log, TEXT("Login Successful!"));
}
else
{
UE_LOG(LogOnlineSubsystem, Error, TEXT("Login Failed: %s"), *Result.GetErrorValue().GetLogString());
}
});
}
And then here’s the code in the PlayerController:
void AMyPlayerController::BeginPlay()
{
Super::BeginPlay();
UMyGameInstance* GameInstance = Cast<UEOSBlueprintGameInstance>(GetWorld()->GetGameInstance());
UMySubsystem* OnlineSubsystem = GameInstance->GetSubsystem<UMySubsystem>();
ULocalPlayer* LocalPlayer = Super::GetLocalPlayer();
if (LocalPlayer)
{
FPlatformUserId LocalPlayerPlatformUserId = LocalPlayer->GetPlatformUserId();
if (OnlineSubsystem) // null-check subsystem before access
{
UE_LOG(LogOnlineSubsystem, Log, TEXT("Logging in PlatformUserId: %d"), LocalPlayerPlatformUserId.GetInternalId());
OnlineSubsystem->Login(LocalPlayerPlatformUserId);
}
}
}
Any help would be greatly appreciated. I want to get this working so I can continue to implement cross play in my game.