0

I am new in developement android apps and java. Now I have developed a app, that stores entries in a mysql-db. My api-language ist php. Until now I was the only user, that used that app, so it was easy to store and receive the data into and from the db. Now I want to give some other my app and I only want to use this one db, that I used before. My app doesn't have a login-system, so my question is, how to identify a user, so that the app gives that user-identification to my php-api and last to my db-query.

Do you have some ideas for me?

A good way would be a device-way to identify the user. A better way would be a user-way to identify, so that that user could use more than one device for his db-entries to get.

Cap
  • 57
  • 7

1 Answers1

0

Since you are using a web API the best way to authenticate is to use cookies. checkout this question link.

Since you are using PHP, instead of writing your own cookie handlers, I would recommend using a framework like laravel which already has cookie authentication.

denniz crypto
  • 451
  • 4
  • 10
  • First of all, thanks for your answer. I'm not sure that cookies solve my problem, cause my app ins't a web-api, it is a native jave-app, only the backgroundscript is in php. Also that solution would not remember a user on multiple devives. I think, I have to install a login-system (I dont want it) or I would like to use the google account informations to remember a user...?? – Cap May 24 '20 at 10:07
  • yes it would work. I have create some app (Native java with back-end (Python/Django)) using cookies for authentication. All you have to do is create an API(back-end) to handle requests and response to android. – denniz crypto May 24 '20 at 10:29
  • Ok. But it only works for one device and after reinstalling the app the data will be lost for the user? – Cap May 24 '20 at 10:41
  • yeah the data on the users phone, but the data in your MySql(username, passwords, emails) database will still be there so the same user can login again on another phone or the same phone.... The same way you can login onto facebook/google using phone/web – denniz crypto May 24 '20 at 12:12