diff --git a/modules/connectors/connectorTicketJira.py b/modules/connectors/connectorTicketJira.py index 93020f2c..91681ba3 100644 --- a/modules/connectors/connectorTicketJira.py +++ b/modules/connectors/connectorTicketJira.py @@ -52,7 +52,7 @@ class ConnectorTicketJira(TicketBase): jql_query = f"project={self.project_code} AND issuetype={self.issue_type}" # Prepare the request URL and parameters - url = f"{self.jira_url}/rest/api/2/search" + url = f"{self.jira_url}/rest/api/3/search/jql" params = {"jql": jql_query, "maxResults": 1, "expand": "names"} # Prepare authentication @@ -126,7 +126,7 @@ class ConnectorTicketJira(TicketBase): # Prepare authentication auth = aiohttp.BasicAuth(self.jira_username, self.jira_api_token) - url = f"{self.jira_url}/rest/api/2/search" + url = f"{self.jira_url}/rest/api/3/search/jql" try: async with aiohttp.ClientSession() as session: @@ -216,7 +216,7 @@ class ConnectorTicketJira(TicketBase): update_data = {"fields": fields} # Make the update request - url = f"{self.jira_url}/rest/api/2/issue/{task_id}" + url = f"{self.jira_url}/rest/api/3/issue/{task_id}" async with session.put( url, json=update_data, headers=headers, auth=auth diff --git a/modules/routes/routeSecurityGoogle.py b/modules/routes/routeSecurityGoogle.py index b8ceb30d..2064f725 100644 --- a/modules/routes/routeSecurityGoogle.py +++ b/modules/routes/routeSecurityGoogle.py @@ -183,6 +183,9 @@ async def login( async def auth_callback(code: str, state: str, request: Request) -> HTMLResponse: """Handle Google OAuth callback""" try: + # Import Token at function level to avoid scoping issues + from modules.interfaces.interfaceAppModel import Token + # Parse state state_data = json.loads(state) state_type = state_data.get("type", "login") @@ -232,7 +235,6 @@ async def auth_callback(code: str, state: str, request: Request) -> HTMLResponse rootInterface = getRootInterface() # Prefer connection flow reuse; fallback to user access token if connection_id: - from modules.interfaces.interfaceAppModel import Token existing_tokens = rootInterface.db.getRecordset(Token, recordFilter={ "connectionId": connection_id, "authority": AuthAuthority.GOOGLE @@ -325,7 +327,6 @@ async def auth_callback(code: str, state: str, request: Request) -> HTMLResponse jwt_token, jwt_expires_at = createAccessToken(jwt_token_data) # Create JWT token - from modules.interfaces.interfaceAppModel import Token token = Token( userId=user.id, # Use local user's ID authority=AuthAuthority.GOOGLE, @@ -444,7 +445,7 @@ async def auth_callback(code: str, state: str, request: Request) -> HTMLResponse connection.externalEmail = user_info.get("email") # Update connection record directly - from modules.interfaces.interfaceAppModel import UserConnection, Token + from modules.interfaces.interfaceAppModel import UserConnection rootInterface.db.recordModify(UserConnection, connection_id, connection.to_dict())