Can not get Token from header in javascript

Hello,

I am trying to start a process from the api. From reading through the internet I found out, that HttpOnly-Cookies can not be accessed withing javascript.

I got the Bonita Tomcat bundle running. I am trying to call from my Vue.js application.

So how am I able to get the Cookies to authenticate for posting to the Bonita API to eg start a Case? So far, whenever using post I get a 401 Unauthorized error.

Hello,

In Angular, you have to do that

this.getHttpConfig = function () {
            var additionalHeaders = {};
            var csrfToken = $cookies.get('X-Bonita-API-Token');
            if (csrfToken) {
                additionalHeaders ['X-Bonita-API-Token'] = csrfToken;
            }
            var config= {"headers": additionalHeaders};
            console.log("GetHttpConfig : "+angular.toJson( config));
            return config;
        }

This is in Angular.

Hope this help,