question

Talha avatar image
Talha asked

User login Using Emails

Scenario: making unity game

So we've just finished with our facebook/deviceID login mechanism. Now we'd like to add Loginthru Email option. Now some things are confusing.

Like Can contactEmail and PlayfabEmail be the same?

can PlayFabUsername and displayName be the same?

basically we want to add this feature First we only want to have the option of logging in thru email. But after they have passed a certain level. login to playfab will be activated. Now they can create an account on PlayFabMasteraccount and for our future game we'd like to check if play has a master account and give rewards accordingly.

How do i go around this hurdle?

As per my understanding RIGHT NOW give the user option to login with email.but there is no password field in title account.

then AFTER certain level open the link to Add usernamePassword right?

But which function is for which? that's confusing.

And which route should we take ideally?

Main Functionality Needed: want user to have an email id and password. want to login the user using email/password and have a password reset option at hand in case they forget the password.

Account Managementgame 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

·
Citrus Yan avatar image
Citrus Yan answered

Like Can contactEmail and PlayfabEmail be the same?

They can be the same. The contact email belongs to Personally Identifying Information (PII), the PlayFab email is used to log in. By default, the contact email filed for a new account is null. You could use AddOrUpdateContactEmail to modify it.

Can PlayFabUsername and displayName be the same?

They can be the same, PlayFabUsername span all titles in the studio and displayName only exists in one title. There are no such constraints to keep displayName different from PlayFabUsername.

How do I go around this hurdle?And which route should we take ideally?

First thing first, there is something you need to know:

  • Master player account contains user attributes such as PlayFabId and external player account links (e.g. Steam) which span multiple titles, Title player account contains title specific attributes such as data objects, leaderboard statistics, and inventories
  • You cannot create another master account because it’s been created when a player logged in using Facebook/DeviceId (your situation).
  • Also, you cannot just only give the user the option to login with email, you have to add username and password to them too because Email, Password and Username are all required in this Function: AddUsernamePassword.
  • Moreover, Title accounts cannot provide the option of logging with email, only master accounts have this capacity.

However, you can still go around this hurdle. There are two options for your consideration.

1. Do the whole logic on player’s side without PlayFab. I mean, when the player opened the game, prompt him to enter email address and password, then it will be stored on local machines for authentication. After that the player can play the game, level up, etc. When the player passed certain level, prompt the player to provide username, then call AddUsernamePassword API to enable login with email(email and password are stored on local machines, account first created via an anonymous auth method such as LogInWithDeviceId).

2.When the player opened the game, he can choose to log in with device id (PlayFab will create a master player account and title player account for you). When the player is playing, store the data that record whether the user has passed a certain level in Player Data(Publisher) which spans more than one title, once the player reached certain level, he can choose to log in with email using AddUsernamePassword API (Username is required too, this operation will not create a master account). In the future when your game studio releases new games, the players use the master account to log in, you can check the publisher data to see if he/she can get rewards and grant to them accordingly. Here are some docs you may want to refer to:

Using Publisher data:https://docs.microsoft.com/en-us/gaming/playfab/features/config/titledata/using-publisher-data

Player Data Management API:https://docs.microsoft.com/en-us/rest/api/playfab/server/player-data-management?view=playfab-rest

As for password reset, you may need to refer to:https://docs.microsoft.com/en-us/gaming/playfab/features/engagement/emails/using-email-templates-to-send-an-account-recovery-email

10 |1200

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

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.