Skip to content

Commit f2d1093

Browse files
fix: asset_id issue with oauth
1 parent 52aefdf commit f2d1093

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

package/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires-python = ">=3.9, <3.14"
77
authors = [
88
]
99
dependencies = [
10-
"splunk-soar-sdk>=1.5.2",
10+
"splunk-soar-sdk==1.6.0",
1111
"validators",
1212
"xmltodict",
1313
]

package/src/auth.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
import json
1515
from abc import ABC, abstractmethod
16-
from typing import Optional, Tuple
16+
from typing import Optional
1717

1818
import requests
1919
from requests.auth import AuthBase, HTTPBasicAuth
@@ -33,7 +33,7 @@ class Authorization(ABC):
3333
"""
3434

3535
@abstractmethod
36-
def create_auth(self, headers) -> Tuple[Optional[AuthBase], dict]:
36+
def create_auth(self, headers) -> tuple[Optional[AuthBase], dict]:
3737
"""
3838
Prepares authentication components for an HTTP request.
3939
@@ -89,7 +89,7 @@ class OAuth(Authorization):
8989
def __init__(self, asset, soar_client):
9090
self.asset = asset
9191
self.soar = soar_client
92-
self.state_key = f"oauth_token_{asset.asset_id}"
92+
self.state_key = f"oauth_token_{self.soar.get_asset_id()}"
9393

9494
def _generate_new_token(self):
9595
"""
@@ -114,9 +114,13 @@ def _generate_new_token(self):
114114
access_token = json.loads(response.text).get("access_token")
115115

116116
except requests.exceptions.RequestException as e:
117-
raise ActionFailure(f"Error fetching OAuth token from {token_url}. Details: {e}") from e
117+
raise ActionFailure(
118+
f"Error fetching OAuth token from {token_url}. Details: {e}"
119+
) from e
118120
except json.JSONDecodeError as e:
119-
raise ActionFailure("Error parsing response from server while fetching token") from e
121+
raise ActionFailure(
122+
"Error parsing response from server while fetching token"
123+
) from e
120124

121125
if not access_token:
122126
raise ActionFailure("Access token not found in response body")

package/uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)