question

blackghostgamesofficial avatar image
blackghostgamesofficial asked

PlayFab web

Hello, I have a problem that I have not been able to solve for weeks. I use PlayFab for my HTML website and have a login and register that works 100% and after login the user comes to account.html page where he can manage his account and there he sees his username and email but there comes the problem there is no data the console says successfully logged in with the playfabid of the logged in user but there is no data. I also tried with GPT4 he doesn't get it either and am now without question here is the account script: https://pastebin.com/KWqzPKhg and in the script is “creationDate” which is irrelevant for now the most important thing is username and email. As js I have the <script type=”text/javascript“ src=”https://download.playfab.com/PlayFabClientApi.js“></script> which is also in register and login and works. In the console I get the following error: ```VM199 PlayFabClientApi.js:219 Uncaught errorLoggedIn ExecuteRequestWrapper @ VM199 PlayFabClientApi.js:219 GetPlayerProfile @ PlayFabClientApi.js:409 getPlayerProfile @ account.html:125 (anonymous) @ account.html:108``` The line 125 is PlayFabClientSDK.GetPlayerProfile(getPlayerProfileRequest, function (result, error) { and the line 108 is getPlayerProfile(playFabId);. And if I do “GetPlayerProfileResult” or “GetPlayerProfileRequest” instead of “GetPlayerProfile”, for example, it doesn't work either

sdks
10 |1200

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

1 Answer

·
Neils Shi avatar image
Neils Shi answered

In fact, you do not need to call additional API GetPlayerProfile to retrieve the player's account info such as displayname, contact email address, etc. When a player calls the login API to log in, you can specify which pieces of info to return for the user by setting the request parameter "InfoRequestParameters" (https://learn.microsoft.com/en-us/rest/api/playfab/client/authentication/login-with-custom-id?view=playfab-rest#getplayercombinedinforequestparams) . For more information, you can refer to my testing request body below:

    "InfoRequestParameters":{
         "GetPlayerProfile":true,
         "ProfileConstraints":{
             "ShowCreated":true,
             "ShowContactEmailAddresses":true,
             "ShowDisplayName":true
         }
       }

In addition, please note that you need to navigate to [Game Manager] -> [Title Settings] -> [Client Profile Options] and tick the “Creation data”/“contact email address”/ “Display name” option so you can access these information on the client side.

10 |1200

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

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.