Hi im trying to send post request with basic auth in cordova ionic framework v6, but the console log response if im not adding it. here is screenshot from console log when i added basic auth :
im following tutorial from ionic documentation ionic documentaion http and the github one cordova-plugin-advanced-http.
but when i didnt use basic auth the header added. I tried with some code like :
this.http.useBasicAuth('user', 'password');
and try adding directly to header param :
this.http.post('someURL', {"username" :username, "password" :password}, {'Authorization': 'Basic ZHJlYW1fMS4wOmRyZWFtXzEuMA==', 'Accept': 'application/json', 'Content-Type':'application/x-www-form-urlencoded'})
but the response always like the image above the header not added. Any solution for this porblem ?, or maybe I am missing something ?.
heres my code :
import { HTTP } from '@awesome-cordova-plugins/http/ngx';
constructor(private http: HTTP) {}
call(){
this.http.post('url', {"username" :variable username, "password" : variable password}, { 'Authorization': 'Basic ZHJlYW1fMS4wOmRyZWFtXzEuMA==', 'Accept': 'application/json', 'Content-Type':'application/x-www-form-urlencoded'})
.then(res=> {
console.log(res);
})
.catch(err=> {
console.log(err);
});
}
thank you in advance.