Remote Affiliate Authentication
The following instructions explain how to let affiliates log into other applications using their NATS usernames and passwords.
The reseller passwords are encrypted in the NATS database to protect NATS and your data, but we've written a script that can receive the username and password of an affiliate to check if that information is correct.
Before using this script, you must setup the array of allowed IPs in your nats/includes/config.php like this:
$config['REMOTE_AUTH_IPS'] = Array ('10.10.10.107', '10.10.10.108');
Make sure you replace the values inside the parenthesis with your IP addresses and the IP address of the server authenticating against NATS.
The Script
The available input variables are:
- username - the username to be authenticated
- password - the password to be authenticated
- ignore_active - if you wish to authenticate regardless of status in NATS database
The return from the script will be: OK - if the authentication was correct NOTOK - if the request came from a bad IP or the authentication was incorrect
Example PHP Post:
<? $auth = file_get_contents("http://linkdomain/remote_auth.php?username=myuser&password=mypass"); if($auth == 'OK'){ //allow them access }else{ //send away from here } ?>
Replace linkdomain with your link domain.