question

appgame avatar image
appgame asked

How are we going to make this happen - Revised

GetProfile & GetProfiles are not
"NotAuthorized"to access opponents data on my account.


CreateMatchmakingTicket DataObject GetMatchmakingTicket LOBBY:
 
Attributes": {
   "DataObject": {
      "GameMode": GameMode,
      "DeviceToken": DeviceToken,
      "PlayFabId": LoginCredentials.PlayFabId
      "DisplayName" : LoginCredentials.DisplayName
   }
}

GetMatchmakingTicket:

List of Users that have joined this GetMatchmakingTicket data.




10 |1200

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

appgame avatar image
appgame answered
"Resource": "pfrn:data--*![SELF]/Profile/*"
CHANGE TO
"Resource": "pfrn:data--*!*/Profile/*",
&
"Principal": "[SELF]" 
CHANGE TO 
"Principal": "*",
*
Local: "file:///android_asset/file.htm";
****
Method does not protected against attack.
10 |1200

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

appgame avatar image
appgame answered

>>> Deleted <<<

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

Sarah Zhang avatar image Sarah Zhang commented ·

Could you please tell us which types of entity did you use to call the GetProfile API? And could you please tell us is it the code of a server or a client?

Generally, Players do not have permission to access profiles other than themselves' profile. Title Entity has permission to access all players' profiles. Because SendPushNotification is server API too. So we would suggest implementing the following steps

GetMatch->GetProfile(to get the masteraccountIds)->GetPlayerProfile(to get the display names)->SendPushNotification

in the server code.

0 Likes 0 ·
appgame avatar image appgame Sarah Zhang commented ·

Thank You for your reply!

Player1 Response->(Player1 : Data),(Player2 : NotAuthorized);

Player2 Response->(Player1 : NotAuthorized),(Player2 : Data);

Again Good if you are sending SendPushNotification to yourself.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang appgame commented ·

Please refer to the doc -- https://docs.microsoft.com/en-us/gaming/playfab/features/data/entities/available-built-in-entity-types for the details of entity types. Title and master player entities do not have permission to access profiles other than themselves' profile. Title Entity has permission to access all players' entity profiles. So player01 cannot access Player02's entity profile.

0 Likes 0 ·
Show more comments
Sarah Zhang avatar image
Sarah Zhang answered

If you don’t have a custom server, we would suggest you host the cloud code on CloudScript. You can call the GetMatch, GetProfile and GetPlayerProfile in the CloudScript function, then use SendPushNotification or use the third party service to send the notifications to the specific players. You can refer to the following CloudScript code.

handlers.getPlayerNamesInMatch = function (args, context) {
    var getMatchResult = multiplayer.GetMatch({
        MatchId: args.MatchId,
        QueueName: "[YourMatchId]",
        EscapeObject: false,
        ReturnMemberAttributes: false
    })
    var memberList = getMatchResult.Members;
    var memberNameList = new Array();
    for (var i = 0; i < memberList.length; i++) {
        var memberProfile = entity.GetProfile({
            Entity: memberList[i].Entity

        })

        var memberPlayerProfile = server.GetPlayerProfile({
            PlayFabId: memberProfile.Profile.Lineage.MasterPlayerAccountId
        });
        log.info(memberPlayerProfile);
        if (memberPlayerProfile.PlayerProfile.DisplayName != null) {
            var playerdisplayName = memberPlayerProfile.PlayerProfile.DisplayName;
            memberNameList.push(playerdisplayName);
        }

    }
    return {
        memberNameList: memberNameList
    };
}

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.

appgame avatar image appgame commented ·

* * * *

Good to know.

Thank You...

0 Likes 0 ·
appgame avatar image appgame commented ·
handlers.CustomGetMatchmakingTicket = function (args, context) {
    var GetMatchmakingTicketResult = multiplayer.GetMatchmakingTicket({
        TicketId: args.TicketId,
        QueueName: args.QueueName,
        EscapeObject: true,
        ReturnMemberAttributes: true
    })

var Response = GetMatchmakingTicketResult;

var getMatchResult = multiplayer.GetMatch({
        MatchId: args.MatchId,
        QueueName: args.QueueName,
        EscapeObject: true,
        ReturnMemberAttributes: true
    })

    var memberList = getMatchResult.Members;
    var memberNameList = new Array();

    for (var i = 0; i < memberList.length; i++) {
        var memberProfile = entity.GetProfile({
            Entity: memberList[i].Entity
 
        })
 
        var memberPlayerProfile = server.GetPlayerProfile({
            PlayFabId: memberProfile.Profile.Lineage.MasterPlayerAccountId
        });

        if (memberPlayerProfile.PlayerProfile.DisplayName != null) {
            var playerdisplayName = memberPlayerProfile.PlayerProfile.DisplayName;
            memberNameList.push(playerdisplayName);
        }
 
    }

var Response["Lobby"] = memberNameList;

return {
        data : Responce
    };
}
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.