question

Rock Bolton avatar image
Rock Bolton asked

Unable to run client and server UE 4.26 due to DeveloperSecretKey

Hello All,

I recently updated my Unreal Engine project from 4.25.4 to 4.26.1 and I am now unable to have a secret key set to test my server and client builds at the same time (pressing the play button in Unreal). I was able to do this when I was using 4.25 with my secret key being set on a server only blueprint custom action, but now if I have the secret key in blueprints at all, the editor crashes with the following error code.

Assertion failed: DeveloperSecretKey.Len() == 0 || ClientSessionTicket.Len() == 0 [File:D:\.....Playfab\MyGame\Plugins\PlayFabPlugin\PlayFab\Source\PlayFabCommon/Public/PlayFabAuthenticationContext.h] [Line: 132] For title security, you cannot set the DeveloperSecretKey on a process which uses a Client Login
I believe my problem is similar to this question but their solution does not appear to work for me.

Thanks for your help!

-Rock

unreal
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Citrus Yan avatar image
Citrus Yan answered

That Assertion was intended to prevent you from setting the DeveloperSecretKey in client builds, for the purpose of not exposing title secrets to the client side. I understand that you are testing server and client builds at the same time, therefore, instead of modifying the source code and setting secret keys in Blueprint, I’d suggest that you pre-configure it in the Editor via "Edit -> Project Settings -> Plugins -> PlayFab". And don't forget to remove it from client build releases.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tibor Dandi avatar image Tibor Dandi commented ·

It does not work sadly,strange thing it was working without any issue with 4.25 ue4 version,now with 4.26 i got the same crash each time like above.

Any support by playfab team please?

0 Likes 0 ·
Anas Siraj avatar image Anas Siraj Tibor Dandi commented ·

Hi @Brendan, this crash is still happening... any way to resolve it? I tried setting the secret in the project settings and even tried setting configs AFTER player logs in and even tried on a seperate Server RPC call

0 Likes 0 ·
Rock Bolton avatar image
Rock Bolton answered

I found a workaround in the meantime of modifying the error causing check (on line 126) to always be truthy like so...

UFUNCTION(BlueprintCallable, Category = "PlayFab | Core")
    void ClientAdminSecurityCheck() const
    {
        checkf(
            DeveloperSecretKey.Len() == 0 || ClientSessionTicket.Len() == 0 || true, // The condition is true/safe if one or the other is length zero
            TEXT("For title security, you cannot set the DeveloperSecretKey on a process which uses a Client Login")
        );
    }

...but something tells me that's not the most correct way forward.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jacob Williams avatar image
Jacob Williams answered

For the sake of not letting this discussion die, I've run into the same problem.

In my case, I have an actor that spawns on the server that sets the DeveloperSecretKey after the game has started, and a separate actor that spawns on clients for logging in and running the client API. The server is dedicated and set to run in a separate process, but I still get this crash on every second run of the game.

The problem is that UPlayFabRuntimeSettings is being cached on both the client and server when they are both started from the Unreal Editor. To workaround this for now, I have to clear the key on the Actor's BeginDestroy. There should be a easier way to test a client/server setup like this, as it's a pretty common scenario.

For those interested in my code:

void APlayFabServer::Init(const FString& SecretKey)
{
	UPlayFabRuntimeSettings* rSettings = GetMutableDefault<UPlayFabRuntimeSettings>();
	rSettings->DeveloperSecretKey = SecretKey;


	serverAPI = IPlayFabModuleInterface::Get().GetServerAPI();
}



void APlayFabServer::BeginDestroy()
{
	Super::BeginDestroy();
	UPlayFabRuntimeSettings* rSettings = GetMutableDefault<UPlayFabRuntimeSettings>();
	rSettings->DeveloperSecretKey = "";
}

,

For the sake of not letting this discussion die, I've run into the same problem.

In my case, I have an actor that spawns on the server that sets the DeveloperSecretKey after the game has started, and a separate actor that spawns on clients for logging in and running the client API. The server is dedicated and set to run in a separate process, but somehow I'm getting this crash on every second run of the game.

The problem is that UPlayFabRuntimeSettings is being cached on both the client and server when started from the Unreal Editor. As a workaround for now, I just clear UPlayFabRuntimeSettings.DeveloperSecretKey on the Actor's BeginDestroy, but I think there should be a better way to do this, as it seems like a common scenario.

For those interested, here's my code.

void APlayFabServer::Init(const FString& SecretKey)
{
	UPlayFabRuntimeSettings* rSettings = GetMutableDefault<UPlayFabRuntimeSettings>();
	rSettings->DeveloperSecretKey = SecretKey;


	serverAPI = IPlayFabModuleInterface::Get().GetServerAPI();
}



void APlayFabServer::BeginDestroy()
{
	Super::BeginDestroy();
	UPlayFabRuntimeSettings* rSettings = GetMutableDefault<UPlayFabRuntimeSettings>();
	rSettings->DeveloperSecretKey = "";


}

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Keith K avatar image Keith K commented ·

In hopes of drawing more attention to this issue, i am writing to say that i have the same issue. It always fails on the second login.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Keith K commented ·

We notice you made a comment in another question and we replied to you there.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.