Skip to content

feat: support Organization Domain Discovery#612

Merged
developerkunal merged 6 commits intov1from
feat/organization-domain-discovery
Oct 16, 2025
Merged

feat: support Organization Domain Discovery#612
developerkunal merged 6 commits intov1from
feat/organization-domain-discovery

Conversation

@ewanharris
Copy link
Contributor

@ewanharris ewanharris commented Sep 26, 2025

🔧 Changes

Warning

This feature is currently behind a feature flag so will not work until the release is finalised

Adds support for the Organization Domain Discovery endpoints and the new property on a client that can be used to control the behaviour for discovery.

package main

import (
	"context"
	"log"

	"github.com/auth0/go-auth0"
	"github.com/auth0/go-auth0/management"
)

func main() {
	mgmt, err := management.New(
		"",
		management.WithClientCredentials(context.Background(), "", ""),
	)
	if err != nil {
		log.Fatalf("err setting up client %+v", err)
	}

	org_id := "ADD_ME"

	// cleanup
	list, err := mgmt.Organization.DiscoveryDomains(context.TODO(), org_id)
	if err != nil {
		log.Fatalf("err getting discovery domains: %+v", err)
	}
	log.Printf("found %d discovery domains", len(list.Domains))

	for _, d := range list.Domains {
		err = mgmt.Organization.DeleteDiscoveryDomain(context.TODO(), org_id, d.GetID())
		if err != nil {
			log.Fatalf("err deleting discovery domain: %+v", err)
		}
		log.Printf("deleted discovery domain: %+v", d)
	}

	domain := &management.OrganizationDiscoveryDomain{
		Domain: auth0.String("example.com"),
		Status: auth0.String("pending"),
	}

	// Create
	err = mgmt.Organization.CreateDiscoveryDomain(context.TODO(), org_id, domain)
	if err != nil {
		log.Fatalf("err creating discovery domain: %+v", err)
	}
	log.Printf("created discovery domain: %+v", domain)

	// List
	list, err = mgmt.Organization.DiscoveryDomains(context.TODO(), org_id)
	if err != nil {
		log.Fatalf("err getting discovery domains: %+v", err)
	}

	for _, d := range list.Domains {
		log.Printf("domain: %+v", d)
	}

	// update
	domain.Status = auth0.String("verified")
	err = mgmt.Organization.UpdateDiscoveryDomain(context.TODO(), org_id, domain.GetID(), domain)
	if err != nil {
		log.Fatalf("err updating discovery domain: %+v", err)
	}
	log.Printf("updated discovery domain: %+v", domain)

	// delete
	err = mgmt.Organization.DeleteDiscoveryDomain(context.TODO(), org_id, domain.GetID())
	if err != nil {
		log.Fatalf("err deleting discovery domain: %+v", err)
	}
	log.Printf("deleted discovery domain: %+v", domain)

}

📚 References

🔬 Testing

Manually tested using above script and automated tests added

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.29%. Comparing base (5749258) to head (9f994d0).

Additional details and impacted files
@@            Coverage Diff             @@
##               v1     #612      +/-   ##
==========================================
+ Coverage   96.27%   96.29%   +0.01%     
==========================================
  Files          62       62              
  Lines       12918    12975      +57     
==========================================
+ Hits        12437    12494      +57     
  Misses        363      363              
  Partials      118      118              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ewanharris ewanharris force-pushed the feat/organization-domain-discovery branch from bb721d5 to 6cffdbc Compare September 30, 2025 14:41
@kushalshit27 kushalshit27 changed the base branch from main to v1 October 9, 2025 12:32
@developerkunal developerkunal marked this pull request as ready for review October 11, 2025 15:20
@developerkunal developerkunal requested a review from a team as a code owner October 11, 2025 15:20
developerkunal
developerkunal previously approved these changes Oct 13, 2025
Copy link
Contributor

@developerkunal developerkunal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@developerkunal
Copy link
Contributor

@claude

@github-actions
Copy link

github-actions bot commented Oct 14, 2025

Claude finished @developerkunal's task —— View job


Review Progress

  • Read project context (AGENTS.md)
  • Analyze PR diff
  • Code quality review
  • Security review
  • Performance review
  • Provide overall assessment

Overall Assessment

⚠️ This PR introduces the Organization Domain Discovery feature with comprehensive test coverage and follows the codebase patterns well. However, there are minor code quality issues that should be addressed: unsafe type assertion in error handling, potential pointer reassignment side effects in the update method, and opportunities to improve test robustness with better random value generation. The documentation also has minor inconsistencies between field names and comments.


Job Run | Branch: feat/organization-domain-discovery

@developerkunal developerkunal merged commit af40837 into v1 Oct 16, 2025
4 checks passed
@developerkunal developerkunal deleted the feat/organization-domain-discovery branch October 16, 2025 08:00
@developerkunal developerkunal mentioned this pull request Oct 31, 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.

4 participants