ch1maera
ch1maera

Reputation: 1447

Limiting an iOS app to installation on only one device

I have an iOS app written in Swift where I want to limit each account to one device only – what is a way that I could go about limiting this access? I'm using Firebase and have a login system but the login system is not linked to Firebase Auth.

Upvotes: 1

Views: 276

Answers (2)

ch1maera
ch1maera

Reputation: 1447

One option that also works, that I found through research, is to store the uid of a device in the database used in the app (or in NSUserDefaults) via UIDevice.current.identifierForVendor!.uuidString. Then, when a user logs in, compare the uuid with the device's uuid and take the appropriate action.

This is not foolproof – if the user uninstalls the app and re-installs it, they will be assigned a different uuid. But in general, this is the best approach.

Upvotes: 1

Aman Gupta
Aman Gupta

Reputation: 179

After login the use generate the token and save them into dataBase. And send this token in header when you hit any other API. If new same use login on other device, update the token in data base .

Now you check this token is same or not if not then send repose code 401 and logout the user.

Upvotes: 1

Related Questions