MCPcopy
hub / github.com/opentrace/opentrace / _refresh_token

Function _refresh_token

agent/src/opentrace_agent/cli/auth.py:329–345  ·  view source on GitHub ↗

Exchange a refresh token for a new access token.

(token_endpoint: str, client_id: str, refresh_token: str)

Source from the content-addressed store, hash-verified

327
328
329def _refresh_token(token_endpoint: str, client_id: str, refresh_token: str) -> dict[str, Any]:
330 """Exchange a refresh token for a new access token."""
331 payload = urlencode(
332 {
333 "grant_type": "refresh_token",
334 "client_id": client_id,
335 "refresh_token": refresh_token,
336 }
337 ).encode()
338
339 req = urllib.request.Request(
340 token_endpoint,
341 data=payload,
342 headers={"Content-Type": "application/x-www-form-urlencoded", "Accept": "application/json"},
343 )
344 with urllib.request.urlopen(req, timeout=30) as resp:
345 return json.loads(resp.read())
346
347
348# ---------------------------------------------------------------------------

Callers 1

refreshFunction · 0.85

Calls 1

readMethod · 0.80

Tested by

no test coverage detected