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:
- Verify the request came from HubSpot.
- Identify the portalId from the payload.
- Look up that portal’s stored refresh token.
- Exchange the refresh token for an access token (if needed).
- 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:
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:
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.
| Brandon Woodruff Senior Software Developer @ PearagonStill have questions? Reach out at brandon@pearagon.com ![]() |

