Unable to import objects with API when integrated OpenID with kibana

we have integrated the OpenID with kibana.
Now trying to import saved objects with internal user admin/admin, curl output says {objects:44, success:true}. but no objects are imported in kibana UI.

Any other way to import objects?, we tried to use keyclock user to import objects but for that user it says unathorized.

Hello,

Kibana has an import mechanism built-in the UI.
Menu > Stack Management > Saved Object > Import (top-right).

Of course, you’ll first need to have your objects exported from your old cluster (export button is next to import).

Hope it helps

1 Like

we have exported ndjosn file, those objects we wanted to automate import objects through script, so we are using import object API to do so using curl command.

we don’t want to use UI to import objects.
below command we are using to import objects.
curl -X POST 'http://localhost:5601/api/saved_objects/_import?overwrite=true’ -H ‘kbn-xsrf: true’ --form file=@export-2.ndjson -k -u admin:admin -H ‘securitytenant: “test-tenant”’

it seems all requests to kibana api endpoints need a kbn-xsrf headers. its value can be anything you want. Without this header kibana will reject calls

The header is present in the above curl command, Issue was because of the order of authc’s in securityconfig/config.yml
I gave 0 order to openID and 1 order to basic HTTP authentication, after reversing it, its working. Actually, it should work in 0 and 1 order also, but not sure why it was not working with 0 and 1 order to OpenID and HTTP authentications respectively.