Fix: declare missing read:group:jira and read:user:jira scopes for Cloud app#435
Open
G0m3e wants to merge 1 commit into
Open
Fix: declare missing read:group:jira and read:user:jira scopes for Cloud app#435G0m3e wants to merge 1 commit into
G0m3e wants to merge 1 commit into
Conversation
Fixes shridhar-tl#342, shridhar-tl#385. On the Cloud (Forge) build, adding a Jira group from User Groups fails with 'Unknown error - Unable to pull user list from group'. Root cause: when calling /rest/api/2/group/member through requestJira, the Atlassian API gateway returns: {"code":401,"message":"Unauthorized; scope does not match"} Per the Atlassian docs, that endpoint requires the granular OAuth scopes read:group:jira, read:user:jira and read:avatar:jira. Only read:avatar:jira was declared, so the request was rejected. Declaring the two missing scopes fixes the searchGroups picker and the subsequent getGroupMembers call used by Add Jira Group.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #342 and #385.
On the Cloud (Forge) build of Jira Assistant, adding a Jira group from Settings → User Groups → Add group → Add Jira Group fails with:
The browser console / Network tab shows the underlying call to
/rest/api/2/group/memberreturning:{"code":401,"message":"Unauthorized; scope does not match"}Root cause
/rest/api/2/group/memberis invoked fromJiraService.getGroupMembersviarequestJira. According to the Atlassian Cloud REST API docs, this endpoint requires the following granular OAuth 2.0 scopes:read:group:jiraread:user:jiraread:avatar:jiraThe current
manifest.ymlonly declaresread:avatar:jira, so the Atlassian API gateway rejects the request before it ever reaches Jira.The picker call
/rest/api/2/groups/pickeris unaffected because it only requiresread:group:jiraor the classicread:jira-user(which is already declared). This explains why the autocomplete search works but the confirm step fails — exactly the symptom users have been reporting.Fix
Add the two missing granular scopes to
manifest.yml:read:avatar:jirais already declared, so no change is needed there. No JavaScript code is modified.Notes for maintainers / users
forge install --upgrade --site …) and the site admin must Accept the newly-requested scopes in Apps → Manage your apps → Review scopes, otherwise the upgraded install will continue to use the old scope set and still 401.UserGroup.jsx'saddNewGroupcatch so future scope mismatches show a more actionable error instead of "Unknown error" — happy to do this in a follow-up PR if desired.Test plan
forge deployforge install --upgrade --site <test-site>.atlassian.netand accept the new scopes/groups/picker) still works