# Calling Secure Elasticsearch API from Custom Kibana Plugin

**URL:** <https://discuss.elastic.co/t/calling-secure-elasticsearch-api-from-custom-kibana-plugin/186134>\
**Category:** Kibana\
**Created:** [June 17, 2019, 6:18pm UTC](https://discuss.elastic.co/t/calling-secure-elasticsearch-api-from-custom-kibana-plugin/186134 "2019-06-17T18:18:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adityaPsl](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adityaPsl](https://discuss.elastic.co/u/adityaPsl)\
**Post date:** [June 17, 2019, 6:18pm UTC](https://discuss.elastic.co/t/calling-secure-elasticsearch-api-from-custom-kibana-plugin/186134/1 "2019-06-17T18:18:51Z")

</div>

Hello Team,

Could you please help understand how to call secured elasticsearch (POST/PUT) api from custom kibana plugin.  
Currently i am using callwithrequest to get and post the indexed data. but just need to understand when API's are secured with some auth method how can we call them using callwithrequest.

Thank you for your help and support.

Thank you,  
Aditya

---

<div class="post-metadata">

**Author:** ![christophilus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christophilus/32/42991_2.png) [@christophilus](https://discuss.elastic.co/u/christophilus)\
**Post date:** [July 2, 2019, 6:52pm UTC](https://discuss.elastic.co/t/calling-secure-elasticsearch-api-from-custom-kibana-plugin/186134/2 "2019-07-02T18:52:35Z")

</div>

It sounds like you're doing it right. `callwithrequest` should pass through any HTTP headers that are required for auth against the target endpoint, so it should "just work".

---

<div class="post-metadata">

**Author:** ![adityaPsl](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adityaPsl](https://discuss.elastic.co/u/adityaPsl)\
**Post date:** [July 6, 2019, 6:16am UTC](https://discuss.elastic.co/t/calling-secure-elasticsearch-api-from-custom-kibana-plugin/186134/3 "2019-07-06T06:16:16Z")

</div>

Thank you christophilus,  
I will test this and will share the observations.

Thank you,  
Aditya

---

<div class="post-metadata">

**Author:** ![adityaPsl](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adityaPsl](https://discuss.elastic.co/u/adityaPsl)\
**Post date:** [July 19, 2019, 5:19pm UTC](https://discuss.elastic.co/t/calling-secure-elasticsearch-api-from-custom-kibana-plugin/186134/4 "2019-07-19T17:19:53Z")

</div>

Thank you christophilus,  
It worked as it is, did not had to do anything to make it work.  
Just one more query , how can we get the logged-in user information in the request or session.  
any pointers or documentation to resolve the issue would help.

Thanks for your help and support.

Thank you,  
Aditya

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 16, 2019, 5:20pm UTC](https://discuss.elastic.co/t/calling-secure-elasticsearch-api-from-custom-kibana-plugin/186134/5 "2019-08-16T17:20:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
