I have defined computed field ”OrgId” in the step 1 of oauth authentication.
Basically i want to save the orgId to the authData object. For which I tried adding a secondary call in the access token request endpoint.
Now if I add a secondary call endpoint in the access token request endpoint then how do I merge the json response of both these respective calls?
I have to save the response to the bundle.authData of both the calls & use bundle.authData.orgId property that was created as a computed field in Step 1. This property will be available for any other action step as it will be saved in the authData.
Please help me with some example how can I add a secondary call to my test endpoint and merge the json response so that authdata has the response of token as well as response of my test API
Thanks
Page 1 / 1
Here’s a contrived example. Let’s say, using the GitHub API, we wanted to grab the user’s username and store it in the bundle.authData context to use in URL path params.
Next, add an API request to your handler for the access token request. You’ll need to make these API requests serially, as you need to wait for the token request to complete so you have a token to use in the request to the user endpoint. When you get the result from the call to the user endpoint, pull out the “login” field and add it to the result and Zapier will store it the computed field and make it available in the authData context.
the code (think through error handling - this is not necessarily ready for production):