• Sign Up Login
  • Features
    • Game Services
    • Real-time Analytics
    • LiveOps
    • Add-ons
  • Game Services
  • Real-time Analytics
  • LiveOps
  • Add-ons
  • Games
  • Pricing
  • Blog
  • Support
    • Docs
    • Forums
    • Contact
  • Docs
  • Forums
  • Contact
  • Sign Up Login
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Ideas
    • Articles
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Dev TeamSolar · Aug 14 at 05:09 AM · Player DataAccount Managementgame manager

Restore existing account on new device after frictionless login

On startup, my game logs the user in with LoginWithAndroidDeviceID (or LoginWithIOSDeviceID) automatically with CreateAccount set to true and the game proceeds to the main menu. Say the user links their Facebook account as a recoverable login option. If they get a new device and want to log into their existing account with their Facebook account linked, how would I do that with my current login flow? So the player starts up the game on their new device and a PlayFab account is automatically created and logged in with the new device ID, but they want to restore and login to their previous existing account on their new device. How can I log into another existing account if they are currently logged into the account that was created on anonymous login? I know I will want to link the new device ID to the existing PlayFab account with the Facebook account already linked, but what will happen to the PlayFab account that just got created?

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Sarah Zhang · Aug 14 at 07:07 AM

LoginWithIOSDeviceID and LoginWithAndroidDeviceID are anonymous login mechanisms. It’s not suitable for restoring accounts. So, if we want to restore an existing account on a new device, we shouldn’t create a new account with a new deviceID. Actually, you have linked players’ accounts with Facebook. You can let players use LoginWithFacebook to log in existing accounts. It is a recoverable login mechanism.

So, your current login flow seems to lose such a “log in with an existing account” option. It's not so flexible to always use anonymous login mechanisms when players log in to the game whether or not they have an existing account. You can add a "log in with an existing account" button in your game login panel to let players choose. When they choose “log in with an existing account”, you can let players use LoginWithFacebook to log in existing accounts. If so, your players can restore existing accounts on new devices.

If you want to learn more about LoginWithFacebook, you can check Tutorials Setting up PlayFab authentication using Facebook and Unity and API references here.

Comment

People who like this

0 Show 2 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SethDu ♦ · Aug 15 at 06:29 AM 0
Share

Also, here is few things you need to know @Dev TeamSolar:

  • We suggest developers to append random-generated string to the original device ID in a safety concern. Usually we don't want anyone to sign in the same account after the owner of device is changed. You may store the modified device ID in the client until the app data or system is wiped.
  • Since now the device ID is unique, there are basically 2 scenarios for your requirements:
    1. Before the Login. You may add a “log in with an existing account” option before the anonymous login like @Sarah Zhang has mentioned. Provide a button that can directly login with Facebook ID.
    2. After the anonymous login. You won't worry about the newly created account since it is blank and device ID is unique. You may also simply provide a button like "login with Facebook" and forget about the newly created account. PlayFab won't care too much about orphan accounts, and you can craft your own way to delete them once a while.
avatar image SethDu ♦ · Aug 15 at 06:31 AM 0
Share

PS. If you have concern about the device ID of newly created account. You can try:

  • Login anonymously, using Device_ID_2
  • Player click Login into Facebook, after the authentication is successfully done and client has received the access token
  • Store the Device_ID_2 and call Unlink API like UnlinkAndroidDeviceID
  • Use Facebook access token to login
  • Call Link API like LinkAndroidDeviceID

This may make sure all the device IDs are linked to the same account but I can say it is quite unnecessary.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    How to get a list of all master player accounts? 1 Answer

    Create non-recoverable account and link with recoverable account 1 Answer

    Is there a way to receive GET requests on the PlayFab Server? 1 Answer

    [Unity] Get Player Country 1 Answer

    How to manage player level achievements? 1 Answer

    • PlayFab

      • Features
      • Games
      • Pricing
      • Blog
    • Engineers

      • Documentation
      • Quickstarts
      • API Reference
      • SDKs
      • Usage Limits
    • Support

      • Forums
      • Videos
      • Contact
      • Service Health
      • Terms of Service
    • Social

      • Facebook
      • Twitter
      • LinkedIn
      • YouTube
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • About Microsoft
    • Jobs
    • Accessibility
    • Diversity & inclusion
    • Security
    • Company news
    • © Microsoft 2019
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Post an idea
    • Create an article
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Ideas
    • Articles
    • Users
    • Badges