How do I get/generate a unique user ID

Get help using Construct 2

Post » Sun Dec 20, 2015 11:49 am

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. :)
B
53
S
16
G
6
Posts: 718
Reputation: 9,150

Post » Sun Dec 20, 2015 9:12 pm

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).
ImageImage
B
108
S
23
G
7
Posts: 1,062
Reputation: 12,683

Post » Sun Dec 20, 2015 11:17 pm

Here's a link with some ideas:
http://stackoverflow.com/questions/2165 ... y-web-site
None of them seem perfect though.
B
91
S
31
G
98
Posts: 5,192
Reputation: 65,170

Post » Tue Dec 22, 2015 5:29 pm

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
B
53
S
16
G
6
Posts: 718
Reputation: 9,150

Post » Wed Dec 23, 2015 7:43 pm

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).
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,396
Reputation: 4,786


Return to How do I....?

Who is online

Users browsing this forum: Gokee, tarek2 and 1 guest