How to use Bearer Token in httpClient GET request?

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 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:

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

1 Like

Tip: See Wiki - how to post code on this forum. 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.

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?

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

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!

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.

will do, thank you