For the Selected site issue in Jira authorization I have below proposed solution.
Configuration and setup as below:
- Configured 2 Jira sites Site1 and Site2.
- Created 2 users User1 and User2.
- Now User1 has access of Site1 only and User2 has access of both sites Site1 and Site2.
- I have created the OAuth 2.0 3LO app in the developer console and have completed the necessary setups that are required to get an access token.
When User1 try to get an access token he gets the authorization screen by JIRA which display only Site1 as below:
When User2 try to get an access token he gets the authorization screen by JIRA which display both sites Site1 and Site2 in dropdown as below:
Now if User1 click on accept then I get Site1 in accessible resources using accessible-resources API.
But the issue is if User2 select any one sites for example Site1 and click on accept then I get Site1 in accessible resources using same API as used above.
So, here I am thinking solution like I will display dropdown in my application which has accessible resources and one link like (change organization). If the user click on that link he will redirect to the authorization page and select another organization and click on accept.
Now I can display both organizations in my app because the user has authorized both organizations and the user can select any organizations in my application and get data like boards and projects etc.
Every time if the user does not show his organization in accessible resources he need to click on change organization link and authorize the organization which he wants.
Also I noticed authorize screen dropdown display all the sites which the user has access evenif we have already authorized for our application.
Does anyone have better solutions for this scenario?