Unknow error in angular http request in the log


Hi guys, I'm trying to do the login from angular 8 to bonita rest api, but I have un unknow error

this is the code

login (bonitaLoginRequest: IBonitaLoginRequest) {

console.log("login service")

let header = new HttpHeaders()

.append('Accept', '*/*')

.append('Content-Type', 'application/x-www-form-urlencoded')

.append('Access-Control-Allow-Origin', '*')

.append('Set-Cookie', 'SameSite=None')

console.log("start call ", JSON.stringify(bonitaLoginRequest))

this.httpClient.post("http://localhost:44896/bonita/loginservice", JSON.stringify(bonitaLoginRequest), {headers: header}).map(res => console.log("res " , res)).subscribe(

data => {



err => {

console.log("ERROR!: ", err);



console.log("end call")


in the bontaLoginRequest there are only username and password

this is the error:

  1. status: 0
  2. statusText: "Unknown Error"
  3. url: "http://localhost:44896/bonita/loginservice"
  4. ok: false
  5. name: "HttpErrorResponse"
  6. message: "Http failure response for http://localhost:44896/bonita/loginservice: 0 Unknown Error"


Submitted by julien.mege on Sun, 04/19/2020 - 19:19


first did you enabled cors for your Bonita server? (see https://documentation.bonitasoft.com/bonita/7.10/enable-cors-in-tomcat-bundle)

then, did you try to make the same call using an API Client like "Postman",

to see if you get more information about the error?

or if it work, and maybe we could have a look at the possible issue in your code?

Submitted by micverriello_1866488 on Mon, 04/20/2020 - 10:48

Hi, I tried to enable cors in tomcat bundle but the error is always the CORS,

from postman it works perfectly

2 answers


Also, to make it work, you need to change the cors configuration provided in the bonitra documentation.

( I will update it as soon as possible)

so you need to change:


by replacing the " * " by the origins you want to authorized. without this, the credentials cannot be automatically passed.


hope this helps,




I am not used to angular 8 so may be I am missing something but where is your login information (username & password)?

May be this AngularJs example can help you:

this.action = function doLogin() {
    var req = {
      method: 'POST',
      url: loginUrl,
      data: angular.copy($scope.properties.login),
      transformRequest: function(obj) {
        var str = [];
        for(var p in obj)
        str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
        return str.join("&");
      headers: {'Content-Type': 'application/x-www-form-urlencoded'}
    return $http(req)
      .success(function(data, status) {
      .error(function(data, status) {
      .finally(function() {


Submitted by micverriello_1866488 on Mon, 04/20/2020 - 15:08

hello, i disable cors security in chrome with a cmd command and now it works