How to prevent 2 people from using the same login

No…

If someone else tried to log in, a tag in Firebase called logged would be set to the other devices name (which can be made up, like random letters and numbers, as long as the own device knows it is its own).

Then when another device tries to log in, its already saved/newly created name will not be the same as this, as we can set it to check in case the extremely unlikely event that it matches, only when creating device unique ID.

Then if new device tries to log in, it sets the logged tag to its device name, so when the older device tries to log in, it does not equal the current value in Firebase. Apologies if my explaining is terrible, but I am certain it would work.

2 Likes

I understand all you say… and it is ok!
The real problem is how to do this :stuck_out_tongue:
I think we need to modify functions in the firebase site… we need to do anything in thunkable app?
I have this project just to try this function: https://x.thunkable.com/projects/5cf7de06c76966a80a368de7/71e219df-c539-4cef-a76f-aa26e74ced6f/designer

Thunkable have a list of tutorials? if not is a good ideia to beginners developers.

1 Like

This is a basic sign in. No checking if user is logged in.

Thunkable X does have tutorials!

They have a YouTube and a Documentation Website.

Also check out this YouTuber!

He has some fantastic tutorials for design and block building. Highly recommended for beginners!

1 Like

Hey eoinparkinson, i think are better you share here this method for us =)

1 Like

It sounds like we are overcomplicating this perhaps - if we are Using Firebase and the sign in component couldn’t you store the UserID when somebody signs in with an email to firebase and then match it when they go to sign in again, the UserID is device specific so it will know if somebody is using it on a different device - see below:

We click button 1 to register a new user. we sign them up, then they sign in then we save their email and their device id,

Then when they open the screen for login (probably best if this was a login button) we call the sign in component then use realtime database and see if device ID on login equals id stored in the database

1 Like

Yes, as I said in an earlier post, this is a good solution.

Thanks so muchhhhh!!!
Its so hard to see this because not are a visible, its only blocks…

I created this blocks…
When I went to test it did not work, I was able to log in to 2 different phones using the same email.

Did i do something wrong?

Yes because user id is your account id, (ie. it is not specific to the device)

Change user ID to a randomly generated number, even 10 digits long, and make a saved variable on the device called myID and a cloud variable called Logged(set the cloud variable and stored variable to the device ID, which is randomly generated, it can be anything). If logged = myID then allow access. If not, continue with sign in but change to the new devices random 10 digit number.

Of course, logged is saved under the username tag (thats how I would do it).

So every name has their own logged cloud variable.

Then, add a listener for logged, under the users username tag in Firebase, then if not = to, go to loading screen. And on the loading screen perform the same check and go to sign in screen.

(edit)

Add listeners on every page, so that a user cannot have the app open then sign in again.

1 Like

can you put a print with this blocks?

like a example by shiver_me_tickets

1 Like

hi.
It looks like you know a lot of thunkable programming and some spotify implementation also.
I hope it is okay to write to you. I hope maybe you can helo me.
I need to know if it is possible in my app to open the spotifi app( that is possible i can do that allready) but i like to log in to a specific account automatically, is that possible you think. And if yes can you help me a little i am newbe in this programming-:slight_smile:

Hi,

I do not know how Spotify works. I only recommended a way to stop two people to log in at the same time. Spotify is more complex. They allow you to connect to WiFi devices and thus at other device logs in and becomes a remote. They do not deny log in, but they have a system in place to stop people listening at the same time if online.

On your point about opening specific accounts in Spotify I have no clue, sorry. And I don’t think this is possible in Thunkable or any app builder. If their app only supports on log in at a time then that is that. You are thinking of something like LastPass or Google Chrome to save passwords for different accounts to allow quick login.

Hopefully this helps you :slight_smile:

Hi again.
No I just like to login to the same account but automatically.

Hi does Spotify not save your passwords in app?

yes but if it is a nother phone that i like to login to my account??

I am unsure on this, apologies.