MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / st_to_at

Method st_to_at

src/services/flow_client.py:1188–1224  ·  view source on GitHub ↗

ST转AT Args: st: Session Token Returns: { "access_token": "AT", "expires": "2025-11-15T04:46:04.000Z", "user": {...} }

(self, st: str)

Source from the content-addressed store, hash-verified

1186 # ========== 认证相关 (使用ST) ==========
1187
1188 async def st_to_at(self, st: str) -> dict:
1189 """ST转AT
1190
1191 Args:
1192 st: Session Token
1193
1194 Returns:
1195 {
1196 "access_token": "AT",
1197 "expires": "2025-11-15T04:46:04.000Z",
1198 "user": {...}
1199 }
1200 """
1201 url = f"{self.labs_base_url}/auth/session"
1202 try:
1203 return await self._make_request(
1204 method="GET",
1205 url=url,
1206 use_st=True,
1207 st_token=st,
1208 timeout=self._get_control_plane_timeout(),
1209 )
1210 except Exception as e:
1211 if not self._is_proxy_connection_error(e):
1212 raise
1213
1214 debug_logger.log_warning(
1215 f"[AUTH] ST->AT failed via configured proxy, retrying direct connection: {e}"
1216 )
1217 return await self._make_request(
1218 method="GET",
1219 url=url,
1220 use_st=True,
1221 st_token=st,
1222 timeout=self._get_control_plane_timeout(),
1223 force_no_proxy=True,
1224 )
1225
1226 # ========== 项目管理 (使用ST) ==========
1227

Callers 7

_st_to_at_for_tokenMethod · 0.80
add_tokenMethod · 0.80
_do_refresh_atMethod · 0.80
update_tokenFunction · 0.80
st_to_atFunction · 0.80
import_tokensFunction · 0.80
plugin_update_tokenFunction · 0.80

Calls 4

_make_requestMethod · 0.95
log_warningMethod · 0.80

Tested by

no test coverage detected