question

janne.mononen@vakigames.com avatar image
janne.mononen@vakigames.com asked

Callbacks not called when using server api functions on unreal engine

Hi. I'm trying to use the unreal engine plugin, but I can't get the server api to work. I got client api working and player authenticated through steam and the player profile is created to playfab. I even changed the displayname and some user data through the client api which is great.

I'm sending the playfab session token and playfab user id from client to the server and then using those to try get user read only data or authenticate the user but neither of those works. Only time the request callbacks are triggered are if for example the user id is missing from the request. I have filled the developer secret and app id to the plugin settings. I even tried to change the api end point in the plugin settings, and after that the error callback started working as it said the end point cannot be reached because it had a typo, so at least that means the ServerApi pointer I have seems to be working. What could be causing the callbacks not to happen? Do i need to open some ports on my dedicated server?

unreal
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.

janne.mononen@vakigames.com avatar image janne.mononen@vakigames.com commented ·

I tested getting the user data with Postman and it worked fine so at least I know the rest api itself is working like I think it should.

0 Likes 0 ·
janne.mononen@vakigames.com avatar image janne.mononen@vakigames.com commented ·

I started debugging the unreal sdk, and I found out that the http request is sent successfully and the callback in the sdk gets response with a valid and correct data, but for some reason that doesn't successfully call the callbacks binded to the request itself.

0 Likes 0 ·
janne.mononen@vakigames.com avatar image
janne.mononen@vakigames.com answered

Hi. I'm using only c++ and I got it eventually working by using the sdk in Actor and not in UObject. And the client doesn't know the server secret. Client only knows it's own authentication token and playfab id. It then sends those to the server and server authenticates the client authentication token and checks that the authenticated playfab id matches the one client has.

10 |1200

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

janne.mononen@vakigames.com avatar image
janne.mononen@vakigames.com answered

Looks like I finally got it working. For some reason if I made the server api pointer like this

PlayFabServerPtr PlayfabServerAPI = nullptr;

I couldn't store a pointer to that from the moduleinterface.

When I changed that line to this

TSharedPtr<class PlayFab::UPlayFabServerAPI> PlayfabSharedPtr;

it started working like it should

1 comment
10 |1200

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

janne.mononen@vakigames.com avatar image janne.mononen@vakigames.com commented ·

Aaaand looks like this worked only for one test and then it started crashing again

0 Likes 0 ·
Seth Du avatar image
Seth Du answered

May I ask are you using Blueprint or C++ to develop your project?

If it is Blueprint, I have noticed that the PlayFab plugin version in Unreal Marketplace lags a lot. I will contact the SDK team and keep you informed if there are any updates. You may check the official repository of PlayFab Unreal SDK, which is the latest version, on https://github.com/PlayFab/UnrealMarketplacePlugin.

>>“I'm sending the playfab session token and playfab user id from client to the server”

If this is the scenario, you may consider using Cloud Script/Azure Function because a client should not hold secret key.

1 comment
10 |1200

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

abuhurairazahid536 avatar image abuhurairazahid536 commented ·

How are you sending this info from client to gamemode because when i send playfab id from bp controller to bp gamemode the gamemode recives a null string although variable thta i'm sending is replicated?

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.