Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
RESTDataSource
posted

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

Parents
  • 5513
    Suggested Answer
    Offline posted

    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

Reply Children