We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to set withCredentials is true when new datamanager ?

My GetData method need to add withCredentials into headers, what should I do when using datamanger binding grid ?

1 Reply

MS Madhu Sudhanan P Syncfusion Team December 19, 2018 08:37 AM UTC

Hi Lorryl, 

Thanks for contacting Syncfusion support. 

You can use the custom adaptor to set withCredential to the DataManager requests. If you are using UrlAdaptor then the custom adaptor to achieve this behavior will be as follows. 

import { DataManager, UrlAdaptor } from '@syncfusion/ej2-data'; 
class CustomAdaptor extends UrlAdaptor { 
  public beforeSend(args: DataManager, xhr: XMLHttpRequest) { 
     xhr.withCredentials = true; 
     super.beforeSend(args, xhr); 

ngOnInit(): void { 
    this.data = new DataManager({ 
      adaptor: new CustomAdaptor 

Madhu Sudhanan P 

Live Chat Icon For mobile
Up arrow icon