How to pass authentication data to bundle inputData in Zapier actions

I’m working on a Zapier integration that uses OAuth2 authentication and everything is functioning properly. However, I need to access certain data from my auth test response in subsequent API requests.

My authentication test returns data like this:

{
  "username": "John Doe",
  "companyId": 45
}

I want to use the companyId value in my other API calls throughout the integration. I tried adding this value to the bundle.inputData object but it doesn’t seem to work as expected.

Is there a proper way to make authentication response data available to other parts of my Zapier app? What’s the recommended approach for passing values from the auth test method to other API operations?

Yeah, bundle.authData works, but there’s a way simpler approach that doesn’t involve wrestling with Zapier’s messy bundle system.

I hit this same issue building an API integration that needed company context from OAuth on every request. Zapier’s auth data persistence turned into a complete nightmare with multiple auth values and conditional logic.

Latenode fixed it completely. You authenticate once at the workflow start, grab whatever data you need from the response, and store it in variables that stick around for your entire automation.

No more wondering if bundle.authData has your values. No more debugging why companyId vanished between steps. Just clean, predictable data flow.

You can see exactly where your auth data goes and how it’s used in later API calls. Way easier to build and maintain these integrations than fighting Zapier’s bundle structure.

Been there, done that. Zapier’s auth data handling is clunky as hell.

You’ll need to store that companyId in bundle.authData during your auth test, then grab it with bundle.authData.companyId in your API calls. But managing these data flows gets messy fast when you’re tracking multiple auth values.

Hit this same wall last year with a client integration. We were pulling user context from OAuth responses for every API call. Zapier’s bundle management made everything harder to maintain and debug.

That’s why I switched to Latenode. The auth flow is way cleaner - store auth response data in variables that stick around for your entire workflow. No more wrestling with bundle objects or guessing if your auth data will be there.

Authenticate once, extract what you need, use it anywhere. The visual workflow shows exactly how data moves between steps.

Saved me hours of debugging and made everything more reliable.

The Problem:

You’re having trouble accessing data from your Zapier OAuth2 authentication test response in subsequent API requests. You want to use the companyId value from the authentication response in other parts of your Zapier integration, but attempts to store it in bundle.inputData haven’t worked as expected.

TL;DR: The Quick Fix:

Use bundle.authData instead of bundle.inputData to store and access your authentication response data. Modify your authentication test function to return the companyId (and any other necessary data) as part of an object. Then, access this data in subsequent steps using bundle.authData.companyId.

:thinking: Understanding the “Why” (The Root Cause):

Zapier uses different bundle properties to manage different types of data. bundle.inputData is designed for data coming from form submissions or other external sources into your Zap. bundle.authData, on the other hand, is specifically for storing data from your OAuth2 authentication process that needs to be accessed in multiple steps within the Zap. Your original approach of storing companyId in bundle.inputData was incorrect because it’s not intended for this type of persistent data across your Zap’s various steps.

:gear: Step-by-Step Guide:

  1. Modify Your Authentication Test Function: Your authentication test function (testAuth or similar) needs to explicitly return the companyId as part of an object. This object will be automatically stored by Zapier in the bundle.authData property. Here’s an example:
const testAuth = (z, bundle) => {
  return z.request({
    url: 'YOUR_AUTH_ENDPOINT', // Replace with your actual authentication endpoint
    method: 'POST', // Or GET, depending on your API
    // ... other request options ...
  }).then(response => {
    const parsedResponse = z.JSON.parse(response.content); //Parse the JSON response
    return {
      companyId: parsedResponse.companyId,  // Make sure this matches your API's response structure
      username: parsedResponse.username      // Include other needed data as well
    };
  });
};
  1. Access companyId in Subsequent Actions: In your other Zapier actions (API calls or other steps) where you need the companyId, access it using bundle.authData.companyId. For instance:
const fetchData = (z, bundle) => {
  const options = {
    url: `YOUR_API_ENDPOINT/${bundle.authData.companyId}/data`, //Using companyId in the URL
    method: 'GET', // or POST
  };
  return z.request(options);
};
  1. Verify Data Persistence: Run a test of your Zapier integration. Check the bundle object at different points in your workflow using z.console.log(bundle) to confirm that companyId is correctly stored in bundle.authData and accessible as expected.

:mag: Common Pitfalls & What to Check Next:

  • Incorrect Field Names: Double-check that companyId exactly matches the key used in your API’s response. Case sensitivity is crucial.
  • API Response Structure: Ensure your API returns the companyId in the expected JSON format. Use z.console.log(response) in your authentication test function to inspect the raw response if you’re having trouble.
  • Zapier Connection Refresh: If you’ve made changes to your authentication test function, refresh your Zapier connection to ensure the changes are properly applied. Old cached data might be causing the issue.

:speech_balloon: Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!

Auth data persistence in Zapier is weird at first. Your authentication test method has to explicitly return everything you’ll need later - Zapier won’t grab stuff automatically from your auth response.

For your situation, update your auth test to return both username and companyId. Then you can use bundle.authData.companyId in other actions. Here’s what bit me while building a project management integration: the auth test has to actually work for data to persist. If it throws errors or returns undefined values, Zapier won’t store your auth data properly.

One more thing - when you’re developing and change what your auth test returns, reconnect your test account. Old auth data hangs around and screws things up until you refresh the connection.

You need to understand how Zapier’s bundle structure works. Your auth test method should return the data you want to keep, and Zapier automatically stores it in bundle.authData for later requests.

In your authentication test function, return the companyId explicitly:

const testAuth = (z, bundle) => {
  return z.request({
    url: 'https://your-api.com/auth/test',
    method: 'GET'
  }).then(response => {
    return {
      companyId: response.json.companyId,
      username: response.json.username
    };
  });
};

Then in your action methods, just access it via bundle.authData.companyId. I ran into the same problem building an inventory management integration - kept trying to manually inject auth data into requests instead of letting Zapier handle it. Once I structured the auth test response right, everything worked perfectly.

Yeah, authData’s your best bet, but heads up - that data can get wiped during testing. I hit this same problem with a payment gateway where the companyId kept disappearing between calls. Just make sure you’re returning the data object correctly from your test method or Zapier won’t store it.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.