Skip to content

Feat: Added Support for Organization Domain Discovery#1209

Merged
tanya732 merged 1 commit intov4from
sdk-6426-organizations-domain-discovery-node-support
Oct 15, 2025
Merged

Feat: Added Support for Organization Domain Discovery#1209
tanya732 merged 1 commit intov4from
sdk-6426-organizations-domain-discovery-node-support

Conversation

@tanya732
Copy link
Contributor

@tanya732 tanya732 commented Oct 15, 2025

Changes

Added /discovery-domains entities and updated /clients entities-

Path Method Type Method Name
/api/v2/organizations/{org_id}/discovery-domains GET getAllDiscoveryDomains
/api/v2/organizations/{org_id}/discovery-domains/{id} GET getDiscoveryDomain
/api/v2/organizations/{org_id}/discovery-domains POST createDiscoveryDomain
/api/v2/organizations/{org_id}/discovery-domains/{id} PATCH updateDiscoveryDomain
/api/v2/organizations/{org_id}/discovery-domains/{id} DELETE deleteDiscoveryDomain
/api/v2/clients POST create
/api/v2/clients GET getAll
/api/v2/clients/{id} PATCH update
/api/v2/clients/{id} GET get

Manual Testing Snippets

  • Install node autho using npm install auth0
  • Initialize your client class with a client ID, client secret and a domain from auth0 dashboard
// Create Client with `organization_discovery_methods` as `organization_name` and `organization_require_behavior`:' `pre_login_prompt`'

const createClientPayload: ClientCreate = {
    name : "TestClient",
    organization_discovery_methods: ["organization_name"],
    organization_require_behavior: "pre_login_prompt",
    organization_usage: "require",
  };

  const createClient = await client.clients.create(createClientPayload);
  console.log('createClient Response Data:', createClient.data);

// Patching the client and removing `organization_discovery_methods` and changing to `organization_require_behavior`: '`post_login_prompt`'
  const updateClientPayload: ClientUpdate = {
  organization_discovery_methods: undefined,
  organization_require_behavior: "post_login_prompt",
  oidc_conformant: true
}

  const updateClient = await client.clients.update({ client_id: createClient.data.id! }, updateClientPayload);
  console.log('updateClient Response Data:', updateClient.data);

// Get Client by Client Id
  const getClient = await client.clients.get({ client_id: createClient.data.id! });
  console.log('getClient Response Data:', getClient.data);

// Get All Clients 
  const getAllClients = await client.clients.getAll({ include_totals: true, page: 0, per_page: 10 });
  console.log('getAllClients Response Data:', getAllClients.data);

Testing snippets for organization_domains

// Create a new domain for the specified {org_id}. Allows setting `status` directly to `verified` or `pending` in the request body and `status` is required and is not defaulted.
  const createDomainDiscoveryPayload: CreateOrganizationDiscoveryDomainRequestContent = {
      domain: 'acme.com',
      status: OrganizationDiscoveryDomainStatus.verified,
  }

  const createDomainDiscovery = await client.organizations.createDiscoveryDomain({id: "<ORG_ID>"},createDomainDiscoveryPayload);
  console.log("createDomainDiscovery", createDomainDiscovery.data);

// Update a domain's properties. Allows updating `status` directly to `verified` or `pending`.
  const updateDomainDiscoveryPayload: UpdateOrganizationDiscoveryDomainRequestContent = {
      status: OrganizationDiscoveryDomainStatus.pending,
  }

  const updateDomainDiscovery = await client.organizations.updateDiscoveryDomain({id: "<ORG_ID>", discovery_domain_id: createDomainDiscovery.data.id!}, updateDomainDiscoveryPayload);
  console.log("updateDomainDiscovery", updateDomainDiscovery.data);

// Retrieve a specific domain by its ID for the specified {org_id}.
  const getDomainDiscovery = await client.organizations.getDiscoveryDomain({id: "<ORG_ID>", discovery_domain_id: createDomainDiscovery.data.id!});
  console.log("getDomainDiscovery", getDomainDiscovery.data);

// Retrieve all domains for the specified {org_id}.
  const getAllDiscoveryDomains = await client.organizations.getAllDiscoveryDomains({id: "<ORG_ID>"});
  console.log("getAllDiscoveryDomains", getAllDiscoveryDomains.data);

// Delete a specific domain.
  const deleteDomainDiscovery = await client.organizations.deleteDiscoveryDomain({id: "<ORG_ID>", discovery_domain_id: createDomainDiscovery.data.id!});
  console.log("deleteDomainDiscovery", deleteDomainDiscovery);

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

  • This change adds unit test coverage
  • This change adds integration test coverage

Checklist

@tanya732 tanya732 marked this pull request as ready for review October 15, 2025 08:47
@tanya732 tanya732 requested a review from a team as a code owner October 15, 2025 08:47
@tanya732 tanya732 merged commit 558a320 into v4 Oct 15, 2025
1 check passed
@tanya732 tanya732 deleted the sdk-6426-organizations-domain-discovery-node-support branch October 15, 2025 10:08
@tanya732 tanya732 mentioned this pull request Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants