sides(server and android) to prevent other users not to use the same account on another device. This the requirement.
Where should i store the unique id ?.
I want to persist the unique id after the user uninstall the app. Android restricted most permissions to system apps.
You can use UUID using either with your backend or firebase and store that in mysql or preferences in Android
What if the app is reinstalled ?
Send deviceId when you generate a new UUID. Then everytime a user opens the app check if the deviceId exists, if true send the original UUID else send a new UUID
Let's take Netflix as an example. Let's you are asked to add functionality to prevent multiple users not to use the same account in other devices. How are going to implement that?.
I will first take the deviceID and the user data when ever a new user signs up. Then generate a UUID (or token) and send it to mobile. Then when ever the user starts the app/signup I will send that token/uuid and deviceId to cross check with the deviceId. If everything is correct, I will send back some response to client to let it continue. If not. Send some message like "token and device id doesn't match" or redirect to signUp. JWT is good for those type of projects. You can put the metadata (userId, deviceId) in the token. Even better, you can give it TTL (time to live) and send a refresh token for better security
I use my own backend application. Ofc I use jwt with allow list strategy. I did the setup in my backend application. The problem is in the Android side. It seems you haven't read google updates. You can't use devise id in recent APIs Jo.
Обсуждают сегодня