I'm trying to consume a REST service that has a basic authentication with angle 6 however I'm not able to follow the code I'm using without success:
public iniciarProcesso(dadosProcesso: string): Observable<any> {
const headers = new Headers()
headers.append('Content-Type', 'application/json')
headers.append('Authorization', 'Basic YWRtaW46YWRtaW4=')
return this.http.post(
this.API,
dadosProcesso,
{headers: headers}
).pipe(map((res) => {
console.log(res)
return res
})
)
}
I get a response:
OPTIONS http://localhost:8080/engine-rest/process-definition/key/agendarEventoTeatro/start 401 (Unauthorized)
Failed to load http://localhost:8080/engine-rest/process-definition/key/agendarEventoTeatro/start: Response for preflight does not have HTTP ok status.
Does anyone have any light how to make this request?
NOTE: I was able to create a proxy file in my project and start the node (ng serve) with --proxy solution (Gambiarra) from that site [ link My question is if I publish my project on the Apache server or any other will it work that "Gambiarra" in localhost worked fine.