How to prevent 2 people from using the same login


#21

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.


#22

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.


#23

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!


#24

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


#25

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


#26

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


#27

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


#28

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?


#29

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.


#30

can you put a print with this blocks?

like a example by shiver_me_tickets