Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by Yousif Ablahad · Jun 10, 2019 at 02:06 PM · CloudScriptAccount ManagementphotonPartner Add-ons

Preventing multiple login simultaneously

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.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

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.

Comment

People who like this

0 Show 1 · 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 Evil Twin · May 05, 2020 at 08:44 PM 0
Share

That thread is from 2016 and here we are 4 years later.

avatar image

Answer by Jorge Mendez · Sep 23, 2020 at 02:35 AM

Hi, is this feature already shipped? Or is it still in WIP?

Comment

People who like this

0 Show 1 · 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 Evil Twin · Sep 23, 2020 at 02:21 PM 0
Share

Yes, session tokens are in, but preventing multiple logins is on you to detect and invalidate the old session.

avatar image

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(); }

Comment

People who like this

0 Show 1 · 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 Mohamed Younes · Oct 03, 2021 at 08:51 AM 0
Share

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.

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

    5 People are following this question.

    avatar image avatar image avatar image avatar image avatar image

    Related Questions

    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

    Issues with a Photon RoomEventRaised webook call 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

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

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges