How do I get/generate a unique user ID

0 favourites
  • 5 posts
From the Asset Store
225 interface, futuristic, ui, sounds that can be used in different kind of games, especially for futuristic, space ones
  • Hi. I am working on a new Project (finally!) and want to recognize users based on some unique ID (Hardware ID or something like that) so that I dont have to use a SQL database to store usernames and Passwords and add a Login Screen. Is it possible to generate a (random) unique ID for each device to use it in variables and strings?

    So I could update the MySQL Database, store the ID and the data and then if the same device sends it again the row with the same ID is overwritten. This would be great.

  • You could assign a username without the player knowing and store it in local storage but if you did it that way you end up losing the best feature of having the database in the first place (being able to use the same account on multiple devices).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here's a link with some ideas:

    http://stackoverflow.com/questions/2165 ... y-web-site

    None of them seem perfect though.

  • Thanks. But how would you create this username GenkiGenga? It should be unique for each device/user.

    Is it possible to use cookies with Construct and Win10 apps? o.O

  • The webserver software that you are using should have cookies.

    We use Apache Tomcat and I use the HttpSession object to store a unique session id that I use to access a server-side in-memory cache that contains all of the specific player info.

    The basic idea is this: http://machinesaredigging.com/2013/10/2 ... sion-work/

    If you don't have cookies, then you have to use an amalgamate of parameters from the request like: External IP, User Agent, Time Zone, SSL parameters, etc.

    Like this: https://panopticlick.eff.org/

    I had come up with the idea of building a unique fingerprint for each computer, based on various request parameters, but it really only works with SSL, Flash, or Java Applets.

    In order for the username to be cryptographically secure, you need to use a cryptographically secure random number generator when creating session IDs, etc. For example, I use a cryptographically secure session ID using the SecureRandom class in Java to generate random bytes which I then convert into a Base64 string and include in the session ID, along with their public IP address, and the date in form (YYYYMMdd).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)