1

Recently I programmed a little app for my android device. As the datastorage for the app, Iam using a mysql database, which can be accessed via different php scipts. So all the app does, is it sends POST requests to the php scripts to communicate to the database.

But now I consider about the security aspect. These php scripts can be accessed by every webclient. So every webclient has the possibility to compromise my database, which is of course not the ideal case. So I was wondering if there is a way to just allow authorized clients to use these php-webservices? Does php provide any kind of authentification that can be used by an android client?
Cheers

3 Answers 3

1

You simply need to require an authentification when invoquing the service:

There are of course other possibilities (WS-Security, but you don't seem to use SOAP).

Sign up to request clarification or add additional context in comments.

1 Comment

Of course, you should have an encrypted connection, in that case... In the long term, you should switch to OAuth, even if it's not so easy (dev.twitter.com/pages/basic_to_oauth)
0

for security, you should prefer to interact through an API to your mysql...isn't it?

Comments

0

A few points:

Use a different port (i.e: not 80 or 8080) for the web access

Add authentication with a username and password. Inside your application, you can get these from a secure config file.

On the server side, you can also do some checking on user agents, IP addresses and maybe even device ids.

This is just a start

1 Comment

I don't see how changing the port secures the service in any way. user-Agent verification gives a false impression of security. As for IP adresses, that's in practice impossible to set up with mobile devices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.