I have been trying to see a way to add authentication to the RESTDataSource. Is there a way we can have it add a custom HTTP Header when it makes it calls, or have it pass the username and password? We don't want to pass that on the URL.
Thanks,
Eric
Hello Eric,
While the ajax calls made by the RESTDataSource (or any other igDataSource derivative) cannot be directly modified, you could set global rules for all of them through the ajaxSetup jQuery method. For example:
:
$.ajaxSetup({ beforeSend: function(xhr) { xhr.setRequestHeader('x-auth-header', 'some value'); } });
This will set the 'x-auth-header' to all ajax requests including those made by the RESTDataSource. You can also refer to this SO thread for more information.
I hope this helps! Thank you for using Infragistics forums!
Best regards,
Stamen Stoychev
In case it helps anybody, I got this working with:
xhr.setRequestHeader('Authorization', 'some value');
Thanks, this might work.