Topic: How to set Authorization header in Autocomplete remote method?

onlinist pro asked 6 years ago


I want to use Autocomplete with remote Data. My Server using Authentication so I have to send "Authorization: Bearer {token}" so how i can add this header before sending the Autocomplete request to server? 


Damian Gemza staff answered 6 years ago


Dear @onlinist 

There's requestOptions in which you can set the request options including the headers

this.dataRemote = completerService.remote(
"http://server.example.com?",
"name",
"name");

let options = new RequestOptions({headers: new Headers()});
options.headers.set("Authorization", token);
this.dataRemote. requestOptions(options);

Best Regards,

Damian



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.0.0
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: No
  • Provided link: No