# How to prevent 2 people from using the same login

**URL:** <https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786>\
**Category:** Questions about Thunkable X\
**Created:** [July 3, 2019, 6:52pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786 "2019-07-03T18:52:34Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [July 11, 2019, 1:24pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/21 "2019-07-11T13:24:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [July 11, 2019, 2:11pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/22 "2019-07-11T14:11:14Z")

</div>

> [@eoinparkinson](#):
>
> 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.

I understand all you say… and it is ok!  
The real problem is how to do this 😛  
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: [Thunkable](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.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [July 11, 2019, 3:07pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/23 "2019-07-11T15:07:01Z")

</div>

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

Thunkable X does have tutorials!

They have a [YouTube](https://www.youtube.com/channel/UCTVZRyybOCDBL2zLXSeQVsw) and a [Documentation Website](https://docs.thunkable.com).

Also check out [this YouTuber](https://www.youtube.com/channel/UCHDDjy-6nbgwdrJpSZIfCOA)!

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

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [July 21, 2019, 3:05am UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/24 "2019-07-21T03:05:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jacob1](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jacob1](https://community.thunkable.com/u/jacob1)\
**Post date:** [July 21, 2019, 7:20am UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/25 "2019-07-21T07:20:51Z")

</div>

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:

 ![35%20pm](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/c/8ce70cdb30f7365bc419b9763fc1574631a71a6e.png)

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

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [July 21, 2019, 11:16am UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/26 "2019-07-21T11:16:37Z")

</div>

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

> [@eoinparkinson](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [July 21, 2019, 6:41pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/27 "2019-07-21T18:41:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [July 22, 2019, 2:02pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/28 "2019-07-22T14:02:32Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/2/c21d0d2da1540a5f796acb5aab48d328f624efc7.png)

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?

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [July 22, 2019, 3:01pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/29 "2019-07-22T15:01:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [July 22, 2019, 3:42pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/30 "2019-07-22T15:42:19Z")

</div>

can you put a print with this blocks?

like a example by shiver\_me\_tickets

---

<div class="post-metadata">

**Author:** ![funhall](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/funhall/32/92145_2.png) [@funhall](https://community.thunkable.com/u/funhall)\
**Post date:** [September 14, 2019, 10:21am UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/31 "2019-09-14T10:21:47Z")

</div>

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-🙂

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [September 14, 2019, 5:10pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/32 "2019-09-14T17:10:31Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![funhall](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/funhall/32/92145_2.png) [@funhall](https://community.thunkable.com/u/funhall)\
**Post date:** [September 14, 2019, 6:14pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/33 "2019-09-14T18:14:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [September 14, 2019, 7:45pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/34 "2019-09-14T19:45:45Z")

</div>

Hi does Spotify not save your passwords in app?

---

<div class="post-metadata">

**Author:** ![funhall](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/funhall/32/92145_2.png) [@funhall](https://community.thunkable.com/u/funhall)\
**Post date:** [September 14, 2019, 8:13pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/35 "2019-09-14T20:13:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [September 14, 2019, 8:14pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/36 "2019-09-14T20:14:21Z")

</div>

I am unsure on this, apologies.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [January 11, 2020, 7:14pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/37 "2020-01-11T19:14:23Z")

</div>

This might be your solution:

> [@How to get a unique device nummer](https://community.thunkable.com/t/how-to-get-a-unique-device-nummer/402306/2):
>
> I would use the push notification component to get a user id. i think this is device specific.
> 
> ![Screen Shot 2020-01-11 at 11.50.15 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/5/f570b499045065e31155f8f7da96102abd93464f.png)

@jared

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [January 11, 2020, 7:30pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/38 "2020-01-11T19:30:52Z")

</div>

I think so, but only partly. I log into my app across 3 devices with the same email and each shows a different device id on the onesignal page. they could still download the app on a different device and register with a different email.

the best way to deter someone from registering for multiple accounts may be using their phone number as part of the rregistration process and requiring a text code sent to them as part of the signup process

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [January 11, 2020, 7:33pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/39 "2020-01-11T19:33:16Z")

</div>

Something that could definitely be looked into, though your idea of using device ID with OneSignal could open up another idea 🙂

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [January 11, 2020, 7:36pm UTC](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786/40 "2020-01-11T19:36:17Z")

</div>

Firebase does also permit registration with phone numbers. Maybe reading the documentation on how to use that and sending it with the sign in/up request somehow.

see here:  
[https://firebase.google.com/docs/web/setup](https://firebase.google.com/docs/web/setup)

putting a webvieweing into the signin screen and dropping in the firebase phonenumber signin code might be a solution.

[Previous page](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786.md?page=1)

[Next page](https://community.thunkable.com/t/how-to-prevent-2-people-from-using-the-same-login/130786.md?page=3)
