I know there are a lot of other threads about this but they all seem to be old at this point and not sure if anything has changed. Is there still no way to prevent multiple login? I have clients signing in using playfab then connecting to photon. I don't want it where people can use the same account in multiple places at the same time. Is there a way to prevent this? I know in one of the other threads you guys mentioned cloud scripting, is this still the only way?
Also, is there a feature to prevent users from purchasing same item twice? or will this have to be done in the clients device by checking and removing the items.
,
I know there are a lot of other threads about this but they all seem to be old at this point and not sure if anything has changed. Is there still no way to prevent multiple login? I have clients signing in using playfab then connecting to photon. I don't want it where people can use the same account in multiple places at the same time. Is there a way to prevent this? I know in one of the other threads you guys mentioned cloud scripting, is this still the only way?
Also, is there a feature to prevent users from purchasing same item twice? or will this have to be done in the clients device by checking and removing the items.
Answer by Hernando · Jun 11, 2019 at 07:59 AM
I believe you have searched for this thread: https://community.playfab.com/questions/382/206721757-How-to-prevent-duplicate-login-.html, and it is still an effective solution to prevent multiple login for now. Besides, as Brendan said, we will be adding session-based login tokens at a later date, at which point you'll be able to invalidate previous tokens for the account on a login. Please keep track on our blog website on: https://blog.playfab.com/blog and we'll be making sure to call this out in our News updates as soon as this is available.
For making an item purchased only once by a player, PlayFab does not provide this feature for now. we recommend that you filter the item out of the list of those shown to the player in the in-game interface, and not allow the player to purchase it via the client. But it should be noted that some hackers could still bypass this and purchase more than one item via HTTP Request tool like Postman.
That thread is from 2016 and here we are 4 years later.
Answer by Jorge Mendez · Sep 23, 2020 at 02:35 AM
Hi, is this feature already shipped? Or is it still in WIP?
Yes, session tokens are in, but preventing multiple logins is on you to detect and invalidate the old session.
Answer by Yash SIdhu · Jun 01, 2021 at 01:26 AM
I searched a lot to find a good solution but ended up making my own, here's the code... enjoy!
it's not guaranteed to work 100% of the time but should work mostly (in my case, all of the time) as it isnt common for randomly generated number to be same.
private void Awake() { DeviceId = UnityEngine.Random.Range(0, 99999); UpdateUserDataRequest request = new UpdateUserDataRequest(); request.Data = new Dictionary<string, string>() { { "ID", DeviceId.ToString()} }; PlayFabClientAPI.UpdateUserData(request, success => { Debug.Log("Successfully Updated Device id " + DeviceId); }, error => { Debug.LogError(error.GenerateErrorReport()); }); StartCoroutine(CheckPlayerID()); } IEnumerator CheckPlayerID() { yield return new WaitForSeconds(15); PlayFabClientAPI.GetUserData(new GetUserDataRequest() { PlayFabId = AccountController.userID, Keys = null }, result => { if (result.Data["ID"].Value != DeviceId.ToString()) { StartCoroutine(AutoLogout()); ErrorGenerator.instance.GenerateError("Another device logged in, logging out in 4 seconds"); } }, (error) => { Debug.Log(error.GenerateErrorReport()); }); StartCoroutine(CheckPlayerID()); } IEnumerator AutoLogout() { yield return new WaitForSeconds(4); Logout(); }
,I searched a lot to find a good solution but ended up making my own, here's the code... enjoy!
it's not guaranteed to work 100% of the time but should work mostly (in my case, all of the time) as it isnt common for randomly generated number to be same.
private void Awake() { DeviceId = UnityEngine.Random.Range(0, 99999); UpdateUserDataRequest request = new UpdateUserDataRequest(); request.Data = new Dictionary<string, string>() { { "ID", DeviceId.ToString()} }; PlayFabClientAPI.UpdateUserData(request, success => { Debug.Log("Successfully Updated Device id " + DeviceId); }, error => { Debug.LogError(error.GenerateErrorReport()); }); StartCoroutine(CheckPlayerID()); } IEnumerator CheckPlayerID() { yield return new WaitForSeconds(15); PlayFabClientAPI.GetUserData(new GetUserDataRequest() { PlayFabId = AccountController.userID, Keys = null }, result => { if (result.Data["ID"].Value != DeviceId.ToString()) { StartCoroutine(AutoLogout()); ErrorGenerator.instance.GenerateError("Another device logged in, logging out in 4 seconds"); } }, (error) => { Debug.Log(error.GenerateErrorReport()); }); StartCoroutine(CheckPlayerID()); } IEnumerator AutoLogout() { yield return new WaitForSeconds(4); Logout(); }
In hope your game becomes successful and you get thousands or maybe millions or DAU, only then you'll know how wrong both approaches are once you get the playfab bill.it's not rocket since to send a request every x seconds, people asking for out of the box solution because the suggested solutions are wrong "Cost wise". you'll be surprised how huge the bill could get. This and other solutions suggested by playfab admin would work, but they are not realistic or real life applicable.
Unlink Android ID thru Cloudscript 2 Answers
Achievement system + Photon webhooks 2 Answers
Delete Master Account,Deleting Master Account 1 Answer
Sending emails not working 3 Answers