Skip to content

Conversation

sooperset
Copy link
Owner

Description

This PR fixes an issue where jira_get_user_profile fails in Multi-Cloud OAuth mode when called with an email address. The API was incorrectly using the username parameter instead of accountId for Jira Cloud instances.

Fixes: #560, #580

Changes

  • Updated JiraConfig.is_cloud property to correctly identify Multi-Cloud OAuth as a Cloud instance
  • OAuth configurations with cloud_id now always return True for is_cloud check
  • Added unit test to verify OAuth cloud detection behavior

Testing

  • Unit tests added/updated
  • Integration tests passed
  • Manual checks performed: Verified that is_cloud returns True for OAuth with cloud_id

Checklist

  • Code follows project style guidelines (linting passes).
  • Tests added/updated for changes.
  • All tests pass locally.
  • Documentation updated (if needed).

Additional Context

In Multi-Cloud OAuth mode, the JIRA_URL environment variable may be None or empty, but the actual API URL used is https://api.atlassian.com/ex/jira/{cloud_id} which is definitely a Cloud URL. The fix ensures that when OAuth is configured with a cloud_id, it's always treated as a Cloud instance, regardless of the configured URL.

This resolves the issue where user lookups were failing with the error: "The 'accountId' query parameter needs to be provided" because the API was incorrectly using username parameter for email-based lookups on Jira Cloud.

- Fix is_cloud property to correctly identify Multi-Cloud OAuth as Cloud instance
- OAuth with cloud_id now always returns True for is_cloud check
- This ensures user lookups use accountId parameter instead of username
- Also fixes Confluence v2 adapter issues in Multi-Cloud OAuth mode
- Add test coverage for OAuth cloud detection

Reported-by: Muhammad Ali
Reported-by: Ian
Github-Issue: #560
Github-Issue: #580
@sooperset sooperset merged commit 3b07fd3 into main Jun 29, 2025
5 checks passed
@sooperset sooperset deleted the fix/oauth-user-profile-accountid branch June 29, 2025 04:13
sooperset added a commit that referenced this pull request Jun 30, 2025
When using Multi-Cloud OAuth with BYOT (Bring Your Own Token) flow,
Confluence's is_cloud property incorrectly returned false because it
only checked the URL pattern. In Multi-Cloud setups, the URL may be
None or empty as requests use api.atlassian.com with a cloud_id.

This fix ensures that OAuth configurations with a cloud_id are always
treated as Cloud instances, enabling proper v2 API adapter activation
and preventing authentication failures.

The implementation matches the fix already applied to Jira in PR #581.

Reported-by: Ian
Github-Issue: #580
sooperset added a commit that referenced this pull request Jun 30, 2025
* fix: detect Confluence Cloud instances in Multi-Cloud OAuth mode

When using Multi-Cloud OAuth with BYOT (Bring Your Own Token) flow,
Confluence's is_cloud property incorrectly returned false because it
only checked the URL pattern. In Multi-Cloud setups, the URL may be
None or empty as requests use api.atlassian.com with a cloud_id.

This fix ensures that OAuth configurations with a cloud_id are always
treated as Cloud instances, enabling proper v2 API adapter activation
and preventing authentication failures.

The implementation matches the fix already applied to Jira in PR #581.

Reported-by: Ian
Github-Issue: #580

* chore: revert uv.lock changes from previous commit

Reverts unintended uv.lock changes that were included in the fix for
Confluence Cloud detection in Multi-Cloud OAuth mode.
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]: Multi-Cloud OAuth mode: cloud_id not recognized despite being sent in header.
1 participant