# OAuth2 Clients. Getting Access Token

**URL:** <https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321>\
**Category:** Ignition\
**Tags:** vision, ignition81, scripting\
**Created:** [April 4, 2024, 2:06am UTC](https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321 "2024-04-04T02:06:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sasi\_Rai](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sasi\_Rai](https://forum.inductiveautomation.com/u/Sasi_Rai)\
**Post date:** [April 4, 2024, 2:06am UTC](https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321/1 "2024-04-04T02:06:02Z")

</div>

Gents,

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/a/ea1ff6b8e1b0786c2a316823faebde09cbc0b617.png)

I have setup an OAuth2 Client and successfully tested getting a token (Client Credential type).

Now, how can I use this in Vision? I would like to get a fresh token when needed, I would also like to read the status code of the request. Obviously will use the token to connect to another site to download other resources.

I have also tried to implement the system.net.httpClient() methods to get the token but it's not working, I am getting a 401. Have tried different header configurations, still error.

It works in Postman. I provided the Client ID and Client Secret, but Postman passes a different value altogether as seen in the Request Headers below:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/7427cdfda73e2400dedc239b74c21dacf7753679.png)

I have read through some of the previous posts but none of them had a solution.

Has anyone been through this and had a proper solution? 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:** [April 4, 2024, 2:51am UTC](https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321/2 "2024-04-04T02:51:48Z")

</div>

Exposing OAuth2 clients to scripting is something we're planning to implement in the future but isn't available right now.

OAuth2-based SMTP profiles are the only thing that use the configured OAuth2 clients.

---

<div class="post-metadata">

**Author:** ![Sasi\_Rai](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sasi\_Rai](https://forum.inductiveautomation.com/u/Sasi_Rai)\
**Post date:** [April 4, 2024, 2:55am UTC](https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321/3 "2024-04-04T02:55:49Z")

</div>

Hi Kev,

That's what I figured out after further reading through the manual. This will be a much sought after addition I believe.

---

<div class="post-metadata">

**Author:** ![Sasi\_Rai](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sasi\_Rai](https://forum.inductiveautomation.com/u/Sasi_Rai)\
**Post date:** [April 4, 2024, 3:00am UTC](https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321/4 "2024-04-04T03:00:43Z")

</div>

Dear All,

For anyone going through this path, here's what I did:

Stuffed all parameters into the header, created a HttpClient and did a post:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/d/edcf705a8ae7999e8ee2b6bba3da43699cb946cd.png)

response.statusCode gives the status code and  
response.test gives the returned string, like so:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/74b30fe080d7b3795efbbd0febffb814bdc32ea6.png)

Cheers.

---

<div class="post-metadata">

**Author:** ![Eric\_Leisebein](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@Eric\_Leisebein](https://forum.inductiveautomation.com/u/Eric_Leisebein)\
**Post date:** [January 6, 2025, 2:57pm UTC](https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321/5 "2025-01-06T14:57:45Z")

</div>

Hi Kevin,

is there any ETA on this?  
Is this even in the pipeline yet?  
I was really excited to see the configuration page for OAuth2.0 because I had to manually deal with this in the past, just to be hit by the reality that it wasn't included as a proper scripting interface.

Thank you very much!

---

<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:** [January 6, 2025, 3:04pm UTC](https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321/6 "2025-01-06T15:04:33Z")

</div>

There isn't a firm timeline associated with this ticket. My guess is it will happen sometime in the 8.3 lifetime.

---

<div class="post-metadata">

**Author:** ![tim.schultz](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@tim.schultz](https://forum.inductiveautomation.com/u/tim.schultz)\
**Post date:** [February 3, 2026, 3:28pm UTC](https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321/7 "2026-02-03T15:28:28Z")

</div>

Sorry to resurrect an old topic, but has there been any more progress on bringing this into scripting for 8.3? This is such a headache comparatively from a maintenance standpoint.

---

<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 3, 2026, 3:34pm UTC](https://forum.inductiveautomation.com/t/oauth2-clients-getting-access-token/88321/8 "2026-02-03T15:34:45Z")

</div>

No change ☹

Best case is this makes it into the 2027.2 release, but looking at the ticket I don't think it's even on the list.

The best way to register your interest is via a support ticket.
