File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 3535 The server request to {server_url}/login is redirected to Jira.
3636 The user is asked to grant access permissions.
3737"""
38+
39+
3840@app .route ("/login" )
3941def login ():
4042 scope = ["read:me" , "read:jira-user" , "read:jira-work" ]
@@ -48,23 +50,29 @@ def login():
4850 session ["oauth_state" ] = state
4951 return redirect (authorization_url )
5052
53+
5154"""
5255 3. Jira redirects user to callback url with authorization code
5356 This should be set to {server_url}/callback.
5457 Access token is fetched using authorization code
5558"""
59+
60+
5661@app .route ("/callback" )
5762def callback ():
5863 jira_oauth = OAuth2Session (client_id , state = session ["oauth_state" ], redirect_uri = redirect_uri )
5964 token_json = jira_oauth .fetch_token (token_url , client_secret = client_secret , authorization_response = request .url )
6065 return "Token: {}<p />Projects: {}" .format (token_json , ", " .join (get_projects (token_json )))
6166
67+
6268"""
6369 4. Access Token used for Jira Python API
6470 Using access token, accessible resources are fetched and
6571 First resource id is taken as jira cloud id,
6672 Jira Client library is called with jira cloud id and token information.
6773"""
74+
75+
6876def get_projects (token_json ):
6977 req = requests .get (
7078 "https://api.atlassian.com/oauth/token/accessible-resources" ,
You can’t perform that action at this time.
0 commit comments