Dynamic org domain and Freshservice domain in OAuth

Hi Team,

I was trying to auto populate the org domain and freshservice domain in the oauth page.

so I used the below code to get the freshservice domain, but it throws me an error “Request timeout”

async function onFormLoad() {
    const client = await app.initialized();
    const data = await client.data.get("currentHost");
    console.log({data})
    const orgDomain = data.currentHost.org_domain;
    utils.set('freshworks_org_domain', { value: orgDomain });
    const {domainName} = await client.data.get("domainName")
    utils.set('freshservice_domain', { value: domainName });
}

Is this the expected output?

Thank you

Hi,

the current fix I made

async function onFormLoad() {
    const client = await app.initialized();
    const data = await client.data.get("currentHost");
    console.log({data})
    const orgDomain = data.currentHost.org_domain;
    utils.set('freshworks_org_domain', { value: orgDomain });
    const FsUrl = new URL(data.currentHost.endpoint_urls.freshservice).host;
    utils.set('freshservice_domain', { value: FsUrl });
}

Need an confirmation whether this fix is relaiable.

Thank you