# API authentication in AWS Lambda function in Custom Workflow Action (public app)

**URL:** <https://community.hubspot.com/t/api-authentication-in-aws-lambda-function-in-custom-workflow-action-public-app/139012>\
**Category:** APIs & Integrations\
**Tags:** workflows, developer-tools, oauth\
**Created:** [September 4, 2025, 6:59pm UTC](https://community.hubspot.com/t/api-authentication-in-aws-lambda-function-in-custom-workflow-action-public-app/139012 "2025-09-04T18:59:24Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![BrandonWoodruff](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/brandonwoodruff/32/61045_2.png) [@BrandonWoodruff](https://community.hubspot.com/u/BrandonWoodruff)\
**Post date:** [September 8, 2025, 1:24pm UTC](https://community.hubspot.com/t/api-authentication-in-aws-lambda-function-in-custom-workflow-action-public-app/139012/3 "2025-09-08T13:24:26Z")

</div>

Hello,

The way that you would want to do it is by storing the Oauth creditials first through a different flow, and then have the Lambda function pull from the Oauth credentials. You would want to do it through the following flow:

1. Verify the request came from HubSpot.
2. Identify the portalId from the payload.
3. Look up that portal’s **stored refresh token**.
4. Exchange the refresh token for an **access token** (if needed).
5. Call HubSpot APIs with that access token to **assign an owner** by updating hubspot\_owner\_id on the contact.

Here are some OAuth Docs from the old docs:

> **[Working with OAuth - HubSpot docs](https://developers.hubspot.com/docs/apps/legacy-apps/authentication/working-with-oauth)**
>
> OAuth is a secure means of authentication for your app. It uses authorization tokens rather than a password to connect your app to a user account.

There is also the new development platform that now sets apps as marketplace, or allows private apps to authenticate through Oauth. The docs are found here:

> **[Working with OAuth - HubSpot docs](https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/oauth/working-with-oauth)**
>
> OAuth is a secure means of authentication for your app. It uses authorization tokens rather than a password to connect your app to a user account.

Let me know if this helps, or if you have any other questions!

* * *

✔ Was I able to help answer your question? Help the community by **marking it as a solution.**

| ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/3/d314478a36473977ed45320812b9331d25e0d3c4.jpeg) | **[Brandon Woodruff](https://www.linkedin.com/in/brandon-woody-woodruff/)**  
Senior Software Developer @ [Pearagon](https://www.pearagon.com/)Still have questions? Reach out at [brandon@pearagon.com](mailto:brandon@pearagon.com) ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/c/dcad77e6cf96145dd117147531ae4423b9b5cd91.png) |

* * *

---

_[View the full topic](https://community.hubspot.com/t/api-authentication-in-aws-lambda-function-in-custom-workflow-action-public-app/139012)._
