First: HTTPS required .
HTTPS ensures that a secure channel is established before any request data is sent. Yes, before sending any request data : URLs, headers, cookies, GET or POST parameters ... whatever. This means that you can use simple methods such as HTTP Basic authentication over HTTPS without putting your user credentials at risk.
This is really non-negotiable if the data you pass to the API is really public. If you are not using HTTPS, any communication with your API (including HTTP Basic credentials) can be sniffed in plain text.
The only reason major sites (like Facebook) do not use HTTPS is because it is becoming expensive on a massive scale.
If you absolutely cannot start HTTPS, you should study OAuth, which takes steps in authenticating the API in this particular situation. With OAuth, you can authenticate users while maintaining credential privacy over unencrypted channels.
Second: authentication is not authorization .
Do not blindly trust data from authenticated users. Make sure that the methods and actions they refer to are appropriate, otherwise you can provide your users with a backdoor to the data or administrative functions of other users.
There is much more than that, but if you follow these two principles, you are already on your way.
source share