question

larsm0806 avatar image
larsm0806 asked

How to check if a player loged in sucessfully ?

Hey there !

Im currently developing an mutliplayer game using Playfab. When the player types in his username and password, it is using this :

//---------------------------//
//        Register Tasks     //
//---------------------------//




PlayFabSettings.TitleId = "5A81";

PlayFabClientModels.RegisterPlayFabUserRequest registerUserRequest = new PlayFabClientModels.RegisterPlayFabUserRequest();

registerUserRequest.DisplayName = "genarTheAdmin";
registerUserRequest.Username = "genarTheAdmin";
registerUserRequest.Password = "------";
registerUserRequest.TitleId = "YouWontSeeIt";

registerUserRequest.RequireBothUsernameAndEmail = false;

registerTask = RegisterPlayFabUserAsync(registerUserRequest);

Thread registerThread = new Thread(registerTask);
registerThread.start();




//---------------------------//
//         Login Tasks       //
//---------------------------//




PlayFabClientModels.LoginWithPlayFabRequest playFabRequest = new PlayFabClientModels.LoginWithPlayFabRequest();

playFabRequest.Username = "genarTheAdmin";

playFabRequest.Password = "------";

playFabRequest.TitleId = "YouWontSeeIt";


loginTask = LoginWithPlayFabAsync(playFabRequest);



Thread thread = new Thread(loginTask);

thread.start();

For signing in. As far as i know, Playfab checks if the Account is already created, if not it just creates a new one, if theres already one, the task will just be ignored.

But when i try to login in, how do i check if the player is loged in sucessfully ?

Player Datagame manager
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

·
brendan avatar image
brendan answered

On a successful login, the response will contain a SessionTicket for the player, which will be good for the ticket lifetime (currently 24 hours). All Client API calls, apart from login and password reset, require the session ticket.

However, the LoginWithPlayFab API call does not create accounts. Unlike the other login calls, it has a different path for account creation - RegisterPlayFabUser. We'll be updating in a future release with new versions of the username/password and email/password login processes, to align those login paths with the other login calls.

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

larsm0806 avatar image larsm0806 commented ·

Thanks for your fast answer, but how do i check now, if the playerlogin was sucessfull ?

0 Likes 0 ·
larsm0806 avatar image larsm0806 commented ·

Thanks for your answer ! So the SessionTicket is delivered by/in the loginTask ?

0 Likes 0 ·
brendan avatar image brendan larsm0806 commented ·

That's correct - all successful login calls return a session ticket. If you're using our SDKs, they are designed to automatically record that as the current player's ticket and apply it to the Client API calls subsequently.

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.