Question

How to modify the domain in authData using Basic Auth

  • 9 January 2024
  • 2 replies
  • 113 views

Hi,

We are currently building an integration with Zapier. Our application uses Basic-Auth, and our clients have user-based domains/URL’s. We want to ensure that when the user completes authentication that the domain in the bundle is correct for that user.

As part of the authentication step, we have built an endpoint that is called to retrieve the correct domain for the user. Is it possible to use this domain in the bundle? This is the code we have for the authentication step
 

const options = {
url: 'https://xxxxxxxxxx/getdomain',
method: 'GET',
params: {
username: bundle.authData.username,
},
};

//The response is the domain for the user. We validate on our side and return the domain for the user

return z.request(options)
.then((response) => {
response.throwForStatus();
const responseData = response.json;

// Concatenate the characters into a single string
const clientDomain = Object.values(responseData).join('');

// Add the clientUrl to the bundle to use in later stages.
//Can we set the domain here and use it in Triggers?
bundle.authData.domain = clientDomain;

// Return the clientUrl
return { clientDomain };

});

Here is an example response after successful authentication:

 

 

Can we add this clientDomain to the authData and use it in Triggers, or is there a different/better approach we should follow?

Any help is greatly appreciated. Many thanks.
 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +14

Hi @TMurray88 

This should be posted in the Developer Zone: https://community.zapier.com/p/developer-zone

Hi @Troy Tessalone I have now posted this in the correct section as listed above. Thank you.