Best practice is to use basic authentication and put your username and password in the header. On the client side, you must add the username and password in the header:
var user = 'user'; var password = 'password'; var base64encodedData = new Buffer(user + ':' + password).toString('base64');
Add this header to all your HTTP requests:
'Authorization': 'Basic ' + base64encodedData
On the server side, this link can help you decrypt your username and password. Do not forget to prevent Man in an average attack , https is required for the api.
source share