# Get token OAuth from Heartbeat before monitoring a service

**URL:** <https://discuss.elastic.co/t/get-token-oauth-from-heartbeat-before-monitoring-a-service/317526>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [October 26, 2022, 1:35pm UTC](https://discuss.elastic.co/t/get-token-oauth-from-heartbeat-before-monitoring-a-service/317526 "2022-10-26T13:35:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbr66](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@rbr66](https://discuss.elastic.co/u/rbr66)\
**Post date:** [October 26, 2022, 1:35pm UTC](https://discuss.elastic.co/t/get-token-oauth-from-heartbeat-before-monitoring-a-service/317526/1 "2022-10-26T13:35:07Z")

</div>

Hi,

We have a health check service that for security reasons we have secured by OAuth, then to invoke it we need to have a valid token. Our current monitor is as follows:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/6/b6a5fe5f1237b11d537c6c23380a5577a338e7da.png)

Is it possible to get a token every so often with heartbeat and add that token to the health check request headers without the need to use a static token as an API Key?

Regards and thanks in advance.

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [October 26, 2022, 2:34pm UTC](https://discuss.elastic.co/t/get-token-oauth-from-heartbeat-before-monitoring-a-service/317526/2 "2022-10-26T14:34:34Z")

</div>

We do currently support that for browser based checks, since they have a full scripting environment with a browser that's possible.

That's not something we currently support for lightweight checks unfortunately. We'd like to add it however, and are tracking that request here: [Multi Step API Journeys · Issue #137 · elastic/synthetics · GitHub](https://github.com/elastic/synthetics/issues/137)

---

<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:** [November 23, 2022, 4:35pm UTC](https://discuss.elastic.co/t/get-token-oauth-from-heartbeat-before-monitoring-a-service/317526/3 "2022-11-23T16:35:23Z")

</div>

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