Skip to content

fix(auth): support --subdomain login for orgs on non-US1 regions#551

Open
haru0017 wants to merge 1 commit into
DataDog:mainfrom
haru0017:fix/oauth-subdomain-site-mismatch
Open

fix(auth): support --subdomain login for orgs on non-US1 regions#551
haru0017 wants to merge 1 commit into
DataDog:mainfrom
haru0017:fix/oauth-subdomain-site-mismatch

Conversation

@haru0017
Copy link
Copy Markdown

@haru0017 haru0017 commented May 31, 2026

What does this PR do?

Use the domain parameter from the OAuth callback to determine the correct token exchange endpoint. Previously, --subdomain login failed with invalid_grant for orgs on non-US1 regions because the token exchange was always sent to api.datadoghq.com.

Motivation

Vanity subdomains can be on a different domain than the org's actual API endpoint (e.g. subdomain on datadoghq.com while the org is on us3.datadoghq.com). When using --subdomain, the authorization URL is correct but the token exchange targets the wrong site. The OAuth callback already includes a domain parameter with the actual site, but it was only used for the success page HTML.

Additional Notes

N/A

Checklist

  • The code change follows the project conventions (see CONTRIBUTING.md)
  • Tests have been added/updated (if applicable)
  • Documentation has been updated (if applicable)
  • All CI checks pass
  • Code coverage is maintained or improved

Related Issues

Closes #550

Use the OAuth callback's domain parameter to determine the correct
token exchange endpoint instead of the configured site.

- Propagate domain through CallbackResult
- Use effective_site for token exchange, token storage, and session storage
- Fall back to configured site when domain is absent

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@haru0017 haru0017 force-pushed the fix/oauth-subdomain-site-mismatch branch from 76e6dc2 to 4dcd6a2 Compare May 31, 2026 11:58
@haru0017 haru0017 marked this pull request as ready for review May 31, 2026 11:59
@haru0017 haru0017 requested a review from a team as a code owner May 31, 2026 11:59
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.

[BUG] --subdomain login fails with invalid_grant on non-US1 regions

1 participant