question

developer-5 avatar image
developer-5 asked

Unity SDK. Facebook login: Playfab creates different accounts instead of using already created

Hello everyone. I had an issue related to log in to Playfab with Facebook Limited. Thanks to @Jay Zuo for helping with my problem. I got the new one. It's about players' accounts. Let's imagine the situation: some users are logged into Playfab by a method which is called "LoginWithFacebook()". Then they updated their iOS to 14.5 that has the updated requirements of IDFA. It's why we have to use "LoginWithOpenID" to log in to Playfab instead of "LoginWithFacebook", which provides us the JWT token. So, if the user is logged with "LoginWithFacebook" from its account and then logins with "LoginWithOpenID" from the same one, Playfab creates a new account instead of using the same. It can disappoint users when a user authenticating from 1 Facebook account receives 2 different Playfab accounts with different data by the reason of using different login ways. I supposed that there is no difference in which way you are using to log in to Playfab if you are using the same account.

Does Playfab have any solutions to find out the user's Playfab account if it logins from the same account by using LoginWithOpenID when it used to login by LoginWithFacebook?

unity3dsdksAuthenticationdatadocumentation
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

·
Sarah Zhang avatar image
Sarah Zhang answered

You can use the PlayFab API series “Linkxxx” to link the new external accounts or identifiers to the existed account without creating a new account. If you want to add the OpenID Connect for an account that already linked to the Facebook, you can use the API LinkOpenIdConnect.

In this case, you need to call the API LinkOpenIdConnect once, then you can use the API LoginWithOpenIdConnect to log in the account using OpenID Connect. To avoid create the new useless account, you can set the field of the login API – CreateAccount as false.

If you currently are not allowed to use the LoginWithFacebook in the iOS application, we would suggest you develop a web form to handle the logic of linking OpenID Connect. The workflow of the account linking could be something like this.

  1. When the player clicks the login button, such as [login using Facebook], you log the players in using LoginWithOpenIdConnect. The field CreateAccount should be set to false.
  2. If the play logs in the account failed, put some prompts to let the player jump to the web form you developed and send the IdToken to the webpage.
  3. Let the player logs in its account with LoginWithFacebook on the web page, then call the API LinkOpenIdConnect to link the OpenID for it. Use the IdToken sent from client in this progress.
  4. After the player finishes the step 3, remind the player to back to the client to call the API LoginWithOpenIdConnect again.

In the workflow, players can link both Facebook and OpenId Connect to the account at the same, so that they can use Facebook account and OpenID Connect to login their accounts on the different devices.

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.