How do I use http get + basic authentication method by postman to connect in an api locally?


#1

Hi everyone, I’m new here and I can not connect my app with local api using basic authentication by postman, that’s my code `import { Http } from ‘@angular/http’;
import { Injectable } from ‘@angular/core’;
import ‘rxjs/add/operator/map’;
import ‘rxjs/add/observable/of’;
import { Headers } from ‘@angular/http’;

@Injectable()
export class ApiProvider {
private baseapiPath = "http://localhost:8080/datasnap/rest"
constructor(public http: Http) {

}

getItens() {
let login = “teste”;
let password = “123”;

let headers = new Headers({ 'Content-Type':'*/*' });
headers.append('Authorization', 'Basic' + (login + ':' + password) );

return this.http.get(this.baseapiPath + "/titensserver/itens", { headers: headers })
  

  

  }

} `


#2

How does the Header field look like inside Postman?


#3

I already managed to solve it, it was problem in the proxy within ionic.config.json


#4

Can You tell How you doing that?

Thanks in advance