# About 2Factor authentication in Hubspot workflow custom code

**URL:** <https://community.hubspot.com/t/about-2factor-authentication-in-hubspot-workflow-custom-code/69460>\
**Category:** HubSpot Ideas\
**Tags:** workflows\
**Created:** [November 17, 2022, 12:37pm UTC](https://community.hubspot.com/t/about-2factor-authentication-in-hubspot-workflow-custom-code/69460 "2022-11-17T12:37:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpal7](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@rpal7](https://community.hubspot.com/u/rpal7)\
**Post date:** [November 17, 2022, 12:37pm UTC](https://community.hubspot.com/t/about-2factor-authentication-in-hubspot-workflow-custom-code/69460/1 "2022-11-17T12:37:53Z")

</div>

i am doing xero api 2 factor authentication from Hubspot workflow custom code.. and i want to hit the user autherization redirect url that can be open a new xero login window and after login, i select the organization and he gave me the access token and refresh token.but i am not able to open the new login window from autherization redirect url in workflow custom code.

---

<div class="post-metadata">

**Author:** ![Nagarjoon](https://avatars.discourse-cdn.com/v4/letter/n/e5b9ba/32.png) [@Nagarjoon](https://community.hubspot.com/u/Nagarjoon)\
**Post date:** [May 27, 2025, 6:45pm UTC](https://community.hubspot.com/t/about-2factor-authentication-in-hubspot-workflow-custom-code/69460/2 "2025-05-27T18:45:36Z")

</div>

HubSpot workflow custom code runs server-side, so it can’t open a browser window for Xero’s login.To handle Xero’s OAuth 2.0 login, you need to trigger the login flow from a client-side app or page, not from the server code. Instead, redirect the user to a custom HubSpot landing page that includes a button linking to the Xero auth URL. Once the user logs in and selects their org, Xero redirects to your redirect URI with a code.Set up a backend (e.g., serverless function) to exchange that code for tokens .Then store the access and refresh tokens in HubSpot using custom properties or a secure storage.Call Xero APIs later from workflow custom code using those stored tokens.

I suggest you give a try [Hubspot xero integration](https://ecosystem.hubspot.com/marketplace/apps/xero-sync-3387409) app This will help to convert deals into Xero invoices & powerful HubSpot workflow actions for Xero

. If you have any questions, you can book a free consultation; their experts will help you integrate - [https://meetings.hubspot.com/cloudify/app-assistance](https://meetings.hubspot.com/cloudify/app-assistance)
