# How to use Bearer Token in httpClient GET request?

**URL:** <https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 27, 2024, 4:10pm UTC](https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446 "2024-02-27T16:10:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben522326](https://avatars.discourse-cdn.com/v4/letter/b/b4bc9f/32.png) [@Ben522326](https://forum.inductiveautomation.com/u/Ben522326)\
**Post date:** [February 27, 2024, 4:10pm UTC](https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446/1 "2024-02-27T16:10:23Z")

</div>

Hello! I'm new to Ignition and API development and have a question about a get request with a bearer token using the maintainX API. I've been following along with the maintainX tutorial [here](https://api.getmaintainx.com/v1/docs#tag/Getting-Started) and using Postman to test get requests.

I set up a bearer token within maintainX and put into the "globals" section of Postman and my simple get requests work correctly in Postman. However, when I try to translate the get request to Ignition Perspective on a button click, I get a "unable to find valid certification path to requested target" error.

I know that I need to include the bearer token in the url or a header somehow, but nothing I've tried has worked. How do I add my bearer token to my get request in ignition?

Button click script:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/f/cf3402feccc0273066a1cbef47df5f6d892ba854.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 27, 2024, 4:16pm UTC](https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446/2 "2024-02-27T16:16:32Z")

</div>

> [@Ben522326](#):
>
> I get a "unable to find valid certification path to requested target" error.

This doesn't have anything to do with your bearer token.

It means either:

1. the certificate used by `api.getmaintainx.com` is not signed by a public CA (unlikely)
2. your IT department is hijacking your SSL/TLS traffic, but you still need to add the root CA they use to do this to Ignition's trust store (likely)

See [Security Certificates | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/platform/security/security-certificates#adding-security-certificates-into-keystores)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 27, 2024, 4:23pm UTC](https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446/3 "2024-02-27T16:23:20Z")

</div>

Tip: See [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). When posted as code it means we can copy and test it or edit it in our answers without having to type it all out again. Post a screengrab as well if you think context will be useful.

---

<div class="post-metadata">

**Author:** ![Ben522326](https://avatars.discourse-cdn.com/v4/letter/b/b4bc9f/32.png) [@Ben522326](https://forum.inductiveautomation.com/u/Ben522326)\
**Post date:** [February 27, 2024, 4:26pm UTC](https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446/4 "2024-02-27T16:26:18Z")

</div>

Ok. Once I get that sorted out, what is the correct way to pass the token in my get request? Do I use the key= parameter or the access\_token= parameter? Or would I include it the header somehow?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 27, 2024, 4:28pm UTC](https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446/5 "2024-02-27T16:28:25Z")

</div>

Do whatever Postman is doing. It should show you the headers and the full URL being used.

---

<div class="post-metadata">

**Author:** ![Alfonso\_Lopez](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Alfonso\_Lopez](https://forum.inductiveautomation.com/u/Alfonso_Lopez)\
**Post date:** [August 27, 2024, 2:47pm UTC](https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446/6 "2024-08-27T14:47:13Z")

</div>

I am having the same issue and using what Postman is doing is not working for me.

It's almost as if the authorization headers were not recognized on the ignition client method. Do you have any more info that could help? I can't find any documentation on the user manual for this.

Thanks!

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 27, 2024, 3:01pm UTC](https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446/7 "2024-08-27T15:01:06Z")

</div>

Start a new post and show us your script and whatever other information is relevant.

The user manual talks about how to pass in headers.

What headers you need to use and whether you have the right key/value is up to you.

---

<div class="post-metadata">

**Author:** ![Alfonso\_Lopez](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Alfonso\_Lopez](https://forum.inductiveautomation.com/u/Alfonso_Lopez)\
**Post date:** [August 27, 2024, 3:11pm UTC](https://forum.inductiveautomation.com/t/how-to-use-bearer-token-in-httpclient-get-request/86446/8 "2024-08-27T15:11:38Z")

</div>

will do, thank you
