Kibana rest api is not accesible with basic auth

I’m trying to setup Kibana spaces with post request. But I’m not able to access the rest API. It always redirects me to login page even if I have basic auth supplied.

example request:

curl --location --request POST 'http://localhost:5601/api/spaces/space' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZWxhc3RpYzplbGFzdGlj' \
--header 'Cookie: JSESSIONID=63124BA39AB9985C78309A58E3E9A752' \
--data-raw '{
    "name": "vvv",
    "id": "vvv",
    "disabledFeatures": []
}'

versions:

readonlyrest-1.30.1_es7.12.1
readonlyrest_kbn_free-1.30.1_es7.12.1

is it possible to make it somehow ?