|
|
@@ -270,17 +270,18 @@ async def verify_tool_servers_config(
|
|
|
elif form_data.auth_type == "session":
|
|
|
token = request.state.token.credentials
|
|
|
elif form_data.auth_type == "system_oauth":
|
|
|
+ oauth_token = None
|
|
|
try:
|
|
|
if request.cookies.get("oauth_session_id", None):
|
|
|
- token = await request.app.state.oauth_manager.get_oauth_token(
|
|
|
+ oauth_token = await request.app.state.oauth_manager.get_oauth_token(
|
|
|
user.id,
|
|
|
request.cookies.get("oauth_session_id", None),
|
|
|
)
|
|
|
except Exception as e:
|
|
|
pass
|
|
|
|
|
|
- if token:
|
|
|
- headers = {"Authorization": f"Bearer {token}"}
|
|
|
+ if oauth_token:
|
|
|
+ headers = {"Authorization": f"Bearer {oauth_token.get('access_token', '')}"}
|
|
|
|
|
|
await client.connect(form_data.url, headers=headers)
|
|
|
specs = await client.list_tool_specs()
|
|
|
@@ -306,10 +307,14 @@ async def verify_tool_servers_config(
|
|
|
elif form_data.auth_type == "system_oauth":
|
|
|
try:
|
|
|
if request.cookies.get("oauth_session_id", None):
|
|
|
- token = await request.app.state.oauth_manager.get_oauth_token(
|
|
|
+ oauth_token = await request.app.state.oauth_manager.get_oauth_token(
|
|
|
user.id,
|
|
|
request.cookies.get("oauth_session_id", None),
|
|
|
)
|
|
|
+
|
|
|
+ if oauth_token:
|
|
|
+ token = f"{oauth_token.get('access_token', '')}"
|
|
|
+
|
|
|
except Exception as e:
|
|
|
pass
|
|
|
|