question

brendan avatar image
brendan asked

Show User There Playfab ID

Politicalpeacestudios
started a topic on Mon, 24 August 2015 at 3:06 AM

I would like my users to be able to see there Playfab ID thats given to them when they first register. Is there anyway I can do this? Is it safe?

10 |1200

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

brendan avatar image
brendan answered

5 Comments
Politicalpeacestudios said on Mon, 24 August 2015 at 3:07 AM

I am using Unity by the way.


Politicalpeacestudios said on Mon, 24 August 2015 at 3:12 AM

Is it with this GetPlayFabIDsFromGameCenterIDs? I do not really understand the documentation, How would I display this on Unity using C#?


Brendan Vanous said on Tue, 25 August 2015 at 12:31 AM

You can retrieve all the account info for the current user via the GetAccountInfo or GetUserCombinedInfo (which also contains the user's inventory and data) API methods on the client.

Brendan


Politicalpeacestudios said on Wed, 26 August 2015 at 4:25 PM

Thanks for the reply Brendan, but to be quite honest I do not know how to translate the documentation to Unity. Just a suggestion, maybe Playfab should have a small example C# code the users could take advantage of more features. I guess my question is, could you help me understand the documentation for GetAccountInfo maybe teach me how to fish. So then I could start using the documentation to the max. Thanks again Brendan!


Brendan Vanous said on Wed, 26 August 2015 at 5:00 PM

We're actually going to be updating our documentation to show examples across multiple languages in the near future. For the moment, here's an example of a call to GetAccountInfo, taken from our login demo project in GitHub:

public static void GetAccountInfo() {

    GetAccountInfoRequest request = new GetAccountInfoRequest();

    PlayFabClientAPI.GetAccountInfo(request, OnGetAccountInfoSuccess, OnPlayFabCallbackError);

}

Since the call in question uses the locally signed in user by default, no parameters need to be set. In your OnGetAccountInfoSuccess function, you would then process the elements returned, to get the PlayFab ID to display to the user. In the demo, it's:

static void OnGetAccountInfoSuccess(GetAccountInfoResult result) {

    PlayFabLoginCalls.LoggedInUserInfo = result.AccountInfo;

    if(OnPlayfabCallbackSuccess != null) {

        OnPlayfabCallbackSuccess("", PlayFabAPIMethods.GetAccountInfo);

    }

}

So the PlayFab ID can be obtained in this example from result.AccountInfo.PlayFabId.

Brendan

10 |1200

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

holly hirzel avatar image
holly hirzel answered

So a user has to be logged in to see their ID? What if they don't remember their ID, how can they retrieve it?

10 |1200

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

brendan avatar image
brendan answered

You don't actually sign in with the PlayFab ID - that's just the underlying identifier in our service. Sign-in for a user can be any of a variety of mechanisms, including device IDs, Facebook, Google, username/password, email/password, etc. Have a look the authentication methods in the Client API for more info on the options available (https://api.playfab.com/Documentation/Client#Authentication). And, of course, since you can link any of these into an account (see the equivalent Link... calls, lower on the page), you can give a player many ways to sign into the same account, which helps to prevent the "forgot my account" issues.

10 |1200

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

duyanha37 avatar image
duyanha37 answered

So how to know the ID

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.

brendan avatar image brendan commented ·

Can you clarify your question? The PlayFab ID of the user account is returned in any number of queries, like GetUserAccount info, as well as every login call. It's fundamental to how a number of API calls work. If you're having trouble getting the PlayFab ID for the signed-in user, can you describe your logic flow?

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.