Looking for a unique identifier of the user

Hello all,

I am looking for a way to get a unique identifier (ID), even without prior registration, in Thunkable X.

  • in Thunkable Classic there is an extension for getting user’s name (I think it is made by puravida -> TaifunAM = account management).

I would use this ID for example in storing values in an online DB. My app shall store some notes (text) from the user in firebase, and it is easy to distinguish the notes from other users by adding an ID to the key.

The EMail / Apple ID would be very nice, but for me it could be sufficient using another ID.

Thanks fpr your help!

2 Likes

I am looking for something similar. But as a workaround you can generate a random number using the Math block, or if you are using Firebase you can use it straight away.

2 Likes

There is a nice little tool in Thunkable that, for certain, will give you a unique ID. It is the clone or create block in Any Component.

Whenever you clone or create a component, Thunkable assigns it a unique ID. You can use this ID as your user ID and then remove the component created/cloned.

2 Likes

Another way of getting a unique ID is to use a local storage DB. Every time you have a new user, create a new row in this DB and read the ID of the newly created row. You will get a unique ID that you can use for your user.

2 Likes

Another one is to Use Firebase sign in and get the user ID.

1 Like

That’s what I do. But I also thought about joining the current date with the current time to create a unique user ID.

3 Likes

@sketch yes you are right but the original post is asking for other means.

Oh haha .
Then you can maybe Use a random math block.

1 Like

If you really want to generate a unique ID then use the web viewer and create the following JavaScript function.

function uuidv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}
1 Like