Skip to main content
Question

Troubleshooting OAuth2 code parameter in custom Zapier integration


I’m trying to create a custom Zapier integration, but it seems that the Platform UI is expecting a `code` query parementer while my auth flow returns it as `access_code`.

I’ve trided using `bundle.cleanedRequest.querystring.access_code` but it seems that the filed is retrieved before any code of the “Access Token Request” step.

What can I do?

 

 

```

const options = {
  url: 'https://myurl/auth/token/',
  method: 'POST',
  headers: {
    'content-type': 'application/x-www-form-urlencoded',
    'accept': 'application/json'
  },
  params: {

  },
  body: {
    'access_code': bundle.cleanedRequest.querystring.access_code,
    'appId': process.env.CLIENT_ID,
    'appSecret': process.env.CLIENT_SECRET,
    'challenge': bundle.inputData.state
  },
  removeMissingValuesFrom: {
    'body': false,
    'params': false
  },
}

return z.request(options)
  .then((response) => {
    const results = response.json;
  
    // You can do any parsing you need for results here before returning them

    return results;
  });

Did this topic help you find an answer to your question?

0 replies

Be the first to reply!