question

panayiotismilios avatar image
panayiotismilios asked

How to manipulate Response Details

Hello,

I have registered a user and now i use the LoginWithEmailAddress() to sign in. My question is how to manipulate the data of InfoResultPayload and get access further down to AccountInfo.

I printed the result Object in my Console and there is nowhere the value of InfoResultPayload that says in the documentation.

//MY EXAMPLE
    
function DoExampleLoginWithEmailAddress() {
	PlayFab.settings.titleId = "A7ED";
    var loginRequest = {
        TitleId: PlayFab.settings.titleId,
        Email: "something@someemail.com",
        Password: "asdafs"
    };

    PlayFabClientSDK.LoginWithEmailAddress(loginRequest, LoginCallback );
}

// CALLBACK FUNCTION FOR EMAIL VALIDATION
var LoginCallback = function (result, error) {
    if (result !== null) {
        let obj = result["data"].PlayFabId;
        document.getElementById("resultOutput").innerHTML = "You're now logged in as: "+ obj;
    } else if (error !== null) {
        document.getElementById("resultOutput").innerHTML =
            "Something went wrong with your login effort.\n" +
            "Here's some debug information:\n" +
            PlayFab.GenerateErrorReport(error);
    }
}


Authentication
screenshot-4.png (14.9 KiB)
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

·
JayZuo avatar image
JayZuo answered

In LoginWithEmailAddress, you can see that InfoResultPayload is Results for requested info. So to get InfoResultPayload, you will need to set InfoRequestParameters in loginRequest. For example:

    var loginRequest = {
        TitleId: PlayFab.settings.titleId,
        Email: "something@someemail.com",
        Password: "asdafs",
        InfoRequestParameters: {
            "GetUserAccountInfo": true,
            "GetUserInventory": true,
            "GetUserVirtualCurrency": true,
            "GetUserReadOnlyData": true,
            "GetPlayerStatistics": true
        }
    };

After this, you should be able to get InfoResultPayload in result response. Besides, after login, you can also use GetAccountInfo or GetPlayerCombinedInfo to get player's account info.

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.

panayiotismilios avatar image panayiotismilios commented ·

Ok, i see thanks a lot!

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.