How to make user login from only one device at a time

后端 未结 7 2881
予麋鹿
予麋鹿 2021-02-04 16:47

I have a RestAPI which when hit authenticate the user. This api is exposed to android and ios developers they hit this api to allow user to login to our app

My requireme

7条回答
  •  天命终不由人
    2021-02-04 17:17

    Good practice would be let the user login from second device and logged out him from first device it would be better from user experience as well as will be easy to handle e.g

    I logged in from DeviceId A (update DeviceId in db against the user) then I try to logged in from DeviceId B (again update DeviceId overriding previous DeviceId in db against the user)

    Now If I make a request from DeviceId A, match the DeviceID in DB, it will return false. Send user back to login page.

提交回复
热议问题