Search code examples
ioslogin-control

How to stop users from using an app over two devices?


I have an iOS application in which i am using Facebook login, and after that phone verification is done which lets the user continue with the app. I ask for phone verification only once when user is being registered.

I wanted to ask if there is any way i can stop users from using the app on two devices? because application records user's footprints(location) and current location, if users use the app on two devices, locations updates will be made by both devices and there won't be any way to tell which location belongs to the user?

Can i use UUID or some other identifier?


Solution

  • Well, I had to do a similar thing once. The app used to have in app purchase of number of device it can run for a single user. What I did was:

    1. I used to take the UUID of the device while signing in to my app and send it to server.

    2. In my server side database could store the UUID against a user. Whenever a user tries to sign in I used send the UUID with the sign in request.

    3. If the UUID was present then I return success response otherwise I used to check the number of device allowed for this user. If adding this device exceeds the limit then I used to send failure response. Otherwise used to insert the UUID against that user and return a success response.

    4. Suppose if a user deletes the app from a device and want to login from another device. Then display a popup like "Do you want to change the device?" If he/she say Yes then I used to update the UUID and allow him/her to use the app in this device. And every time the app starts (new launch or from background) I used to check the UUID against server's UUID.

    You can design your own system but using device UUID gives some extra benefit. like you don't need to store the UUID anywhere and you can rely on its uniqueness.