Skip to content

Commit 2a0e3f1

Browse files
fix(auth): change auto ark api key filter to get larger access right (#331)
* fix(auth): change auto ark api key filter to get larger access right * update logs
1 parent 58ec6f4 commit 2a0e3f1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

veadk/auth/veauth/ark_veauth.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_ark_token(region: str = "cn-beijing") -> str:
3636
session_token = cred.session_token
3737

3838
res = ve_request(
39-
request_body={"ProjectName": "default", "Filter": {}},
39+
request_body={"ProjectName": "default", "Filter": {"AllowAll": True}},
4040
header={"X-Security-Token": session_token},
4141
action="ListApiKeys",
4242
ak=access_key,
@@ -48,6 +48,10 @@ def get_ark_token(region: str = "cn-beijing") -> str:
4848
)
4949
try:
5050
first_api_key_id = res["Result"]["Items"][0]["Id"]
51+
logger.warning("By default, VeADK fetches the first API Key in the list.")
52+
logger.info(
53+
f"Try to fetch ARK API Key with id={first_api_key_id}, name={res['Result']['Items'][0]['Name']}"
54+
)
5155
except KeyError:
5256
raise ValueError(f"Failed to get ARK api key list: {res}")
5357

@@ -65,7 +69,7 @@ def get_ark_token(region: str = "cn-beijing") -> str:
6569
)
6670
try:
6771
api_key = res["Result"]["ApiKey"]
68-
logger.info("Successfully fetching ARK API Key.")
72+
logger.info(f"Successfully fetched ARK API Key (starts with {api_key[:8]}).")
6973
return api_key
7074
except KeyError:
7175
raise ValueError(f"Failed to get ARK api key: {res}")

0 commit comments

Comments
 (0)