Categories
android mysql php rest session

How to manage session tokens among various client apps (android/iphone) from server side php and mysql?

I have a rest API developed using php and mysql.

I need manage different client apps including Android and iPhone. I just want to allow only one user from one type of device.

For instance: if a user is using the app on Android and iPhone at the same time, this can be allowed. However, if a user tries to use the app more than one time on the same device, either Android or iPhone, it would not be allowed.

How I can achieve this? I am issuing 3 types of tokens at a time, such as token_iphone, token_android, etc. Currently my problem is, if any user logged in from the same type of device, the first instance the user started get its token expired or replaced with the new one.

Any help would be highly appreciated.