question

doronhn avatar image
doronhn asked

link device or create account?

Hey,

Fast question:

When i try to login to Facebook i get access token.

Then i have two option:

1. link to an existing account on PlayFab

2. create new Its two different methods, its mean that i need to check before calling the PlayFab API if the user was guest before.

Am i missing something?

Am i right?

apissdks
10 |1200

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

Andy avatar image
Andy answered

If you're already logging players in through an anonymous device identifier (a guest, as you put it), then you should call the link API once you have a Facebook token. From then on, they can continue to sign in silently using the device id, but it will be linked to Facebook should they need to recover it at some point.

Our Linking and Unlinking tutorial goes into more detail: https://api.playfab.com/docs/tutorials/landing-players/account-linking.

Here's a snippet of the tutorial that addresses what your scenario:

Use an anonymous login to create new players with zero friction. After a tutorial phase, gently encourage players to link your preferred choice of recoverable credentials to their account. If you're using a third-party authentication system, retrieve the appropriate token from that service (via API calls or SDK functions), then call the appropriate PlayFab API to link the player's account from that service to their PlayFab account: LinkFacebookAccount, LinkGameCenterAccount, LinkGoogleAccount, LinkKongregate, LinkSteamAccount, LinkTwitch, LinkWindowsHello.

10 |1200

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

marcowilliamspf avatar image
marcowilliamspf answered

In addition to Andy's answer, you should also check out our Login Best Practices and our Authentication Sample on Github and the video tutorial series I've done on Authentication with PlayFab

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.