question

appgame avatar image
appgame asked

GetUserAccountInfo -> ErrorDetails >= "The PlayFabId field is required."

Hello,

  1. Error -> GetUserAccountInfo;

server.GetUserAccountInfo({

“Email”,

”PlayFabId”,

”TitleDisplayName”,

”Username” /**(all can be used as the unique identifier.) **/

});

  • ¯\_(ツ)_/¯
  • errorDetails:
  • "The PlayFabId field is required."
handlers.GetUserAccountInfo = (args, context) => {
    try {
        
        var memberPlayerProfile = server.GetUserAccountInfo({
            TitleDisplayName: args.TitleDisplayName
        });

	var F = server.GetUserData({ 
		PlayFabId: "(( memberPlayerProfile -> PlayFabId ))"
	});

	memberPlayerProfile["GetUserData"] = F;

        return memberPlayerProfile;


    } catch (ex) {
        let error = ex.apiErrorInfo.apiError.error;
        let errorCode = ex.apiErrorInfo.apiError.errorCode;
    };
}

  • ( ◠‿◠ )
  • What Does Work

POST:

URL: https://12345.playfabapi.com/Admin/GetUserAccountInfo?sdk=JavaScript

BODY = {"TitleDisplayName":"RobbieDog","TitleId":""}

Responce:
data:
	UserInfo:
		Created: "2020-07-09T21:36:15.027Z"
		PlayFabId: ""
		PrivateInfo: {Email: ""}
	TitleInfo: {
		DisplayName: "RobbieDog", 
		Origination: "Organic", 
		Created: "2020-07-09T21:36:15.027Z", 
		LastLogin: "2020-09-26T04:49:03.319Z", 
		FirstLogin: "2020-07-09T21:36:15.027Z", …}
Username: "robertzzd"

  • (҂`_´)
  • Bypass of a recognized problem or limitation in the system

handlers.GetUserAccountInfo = (args, context) => {
    try {
        
        memberPlayerProfile = PostFunction(args);

	var F = server.GetUserData({ 
		PlayFabId: "(( memberPlayerProfile -> PlayFabId ))"
	});

	memberPlayerProfile["GetUserData"] = F;

        return memberPlayerProfile;


    } catch (ex) {
        let error = ex.apiErrorInfo.apiError.error;
        let errorCode = ex.apiErrorInfo.apiError.errorCode;
    };
}



function PostFunction(args){
    var headers = {
        "X-PlayFabSDK": "JavaScriptSDK-1.63.200402"
    };
    
    if(args.SessionTicket != undefined){ 
	headers['X-Authorization'] = args.SessionTicket;
    }
    if(args.SecretKey != undefined){headers['X-SecretKey'] = args.SecretKey;}


    var url = "https://12345.playfabapi.com/Admin/GetUserAccountInfo?JavaScriptSDK-1.63.200402";
    var content = JSON.stringify( args.BODY );
    var httpMethod = "post";
    var contentType = "application/json";


    var response = http.request(url, httpMethod, content, contentType, headers);
    return JSON.parse(response);
}
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

·
appgame avatar image
appgame answered

Hello

  • (҂`_´)
  • GetUserAccountInfo -> PostAccountInfo -> GetAccountInfo -> GetUserData
handlers.GetUserAccountInfo = (args, context) => {
    try {
        
        Profile = PostAccountInfo(args);
 
	    var F = server.GetUserData({ 
		    PlayFabId: Profile.data.AccountInfo.PlayFabId
	    });
 
	    Profile["GetUserData"] = F;
 
        return Profile;
 
 
    } catch (ex) {
        let error = ex.apiErrorInfo.apiError.error;
        let errorCode = ex.apiErrorInfo.apiError.errorCode;
    };
}




function PostAccountInfon(args){
    var headers = {
        "X-PlayFabSDK": "JavaScriptSDK-1.63.200402"
    };
    
    if(args.SessionTicket != undefined){ 
	    headers['X-Authorization'] = args.SessionTicket;
    }
    
    if(args.SecretKey != undefined){
        headers['X-SecretKey'] = args.SecretKey;
    }
 
 
    var url = "https://12345.playfabapi.com/Client/GetAccountInfo?JavaScriptSDK-1.63.200402";
    var content = JSON.stringify( args.BODY );
    var httpMethod = "post";
    var contentType = "application/json";
 
 
    var response = http.request(url, httpMethod, content, contentType, headers);
    return JSON.parse(response);
}
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.

Citrus Yan avatar image Citrus Yan commented ·

One thing to note is that it's not recommended to issue a custom http request to the client/admin api endpoints, you can make a feature request about adding more queryable parameters for the server GetUserAccountInfo API to consume, here: https://community.playfab.com/spaces/24/index.html

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.