Reputation: 2459
I have a website with quite a lot of users. Their passwords are stored in a mysql database and I hashed them using php 7 password_hash and when a user logs in I use password_verify
I now however want to build an iOS app using swift. I have seen that you can connect to a mysql database which is fine for CRUD operations but my problem is users registering and logging in.
Is there a way to tap into php's password_verify and password_hash?
Any suggestions would be appreciated as I want the impact, if any, on the existing users to be minimal.
Upvotes: 0
Views: 168
Reputation: 1703
You will still have to do the password verification on the server using PHP by creating an API that the iOS app can talk to.
What you have right now is a Server which holds the website code and the database. When a user logs in via a web browser (the client) the web browser sends the username/password to the server and the server does the work of verification and sends the response to the client.
An iOS app will also be a client. When a user enters a username/password on the iOS client, take that information and send it to the server and have the server do the verification and send back a response to the iOS client.
Do a search for REST api
to see how to build what you are looking for on the server. And look at NSURLSession
in the apple docs to see how to communicate with your server.
Upvotes: 3