I am experimenting with the option to make a Suitelet available without login.
I would like to limit the use of this Suitelet (without using NetSuite logins), and I am reviewing options for this.
I've found the suitescript that can be used to request a parameter from the URL and check that:
var authParam = context.request.parameters['auth']
if (authParam == 'Abc213') {
context.response.write('OK<br />');
context.response.write(authParam);
} else {
context.response.write('FAIL<br />');
context.response.write(authParam);
}
This provides some protection, but if the URL is shared/copied, then this URL will work anywhere.
Is there any way to access the client IP address from within Suitescript? I have found a number of articles online referencing JavaScript solutions for this (using third party plugins), but I'm not sure if these could be built into a Suitelet.
Ideally I would like to include a 'whitelist' of allowed IP addresses that the Suitelet can be run from (and then deny it from all other locations). Is this possible?
Another idea was to check for the presence of a local file on the PC (either check the file is present, or check the contents of the file) and allow / deny based on this? Is there an example Suitelet for this?