question

c-ming2004 avatar image
c-ming2004 asked

How to avoid two devices login to the same account at the same time?

I am using Unity and PlayFab.

In my case, I uses "LoginWithCustomIDRequest"

Device A > create Account A > linked Facebook A

Device B > create Account B > login Account A by Facebook A

At the end,

Account A > linked Device A, Device B, Facebook A

In this result, can Device A and Device B login Account A at the same time?

How to avoid 2 devices login into same account at the time?

Option 1) Unlink Device A from account A, how to get the Device A ID from C# script?

Option 2) Is there are setting or code can avoid this?

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

Yes, the account A can be logged in to two devices at the same time. For clarification, sign-ins to PlayFab have no states, after player call the sign-in APIs, PlayFab will return the SessionTicket and EntityToken for players to access the client API. Then, the account can be logged in to other devices too. And currently, there is no official support for the feature to prevent the same account is logged in to two device at the same time. The workaround mentioned in this thread - How to prevent duplicate login? - Playfab Community is still the recommended solution to block the second-screen sign-ins. You can implement this logic using PlayFab Rules and PlayFab CloudScript using Azure Functions.

Besides, The thread in the first paragraph descripted a workaround to “log out” players through removing local credentials such as SessionTicket and EntityToken for the old device. The API LinkXXXDeviceId is designed to add a type of login method for player accounts to implement the anonymous login based on the specific device Id. UnLinkXXXDeviceId is designed to cancel this anonymous login method, not related to remove the local credentials. For PlayFab Unity SDK, you can call the SDK method - ForgetAllCredentials() to remove the local credentials.

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.