Avoid refreshing Codex token in settings
This commit is contained in:
@@ -283,7 +283,8 @@ def _oauth_provider_status(spec: Any) -> dict[str, Any]:
|
||||
|
||||
if spec.name == "openai_codex":
|
||||
try:
|
||||
from oauth_cli_kit import get_token as get_codex_token
|
||||
from oauth_cli_kit.providers import OPENAI_CODEX_PROVIDER
|
||||
from oauth_cli_kit.storage import FileTokenStorage
|
||||
except Exception:
|
||||
return {
|
||||
"configured": False,
|
||||
@@ -293,10 +294,14 @@ def _oauth_provider_status(spec: Any) -> dict[str, Any]:
|
||||
}
|
||||
token = None
|
||||
with suppress(Exception):
|
||||
token = get_codex_token()
|
||||
token = FileTokenStorage(
|
||||
token_filename=OPENAI_CODEX_PROVIDER.token_filename,
|
||||
).load()
|
||||
expires_at = getattr(token, "expires", None) if token else None
|
||||
return {
|
||||
"configured": bool(token and token.access),
|
||||
"configured": bool(
|
||||
token and token.access and expires_at and expires_at > int(time.time() * 1000)
|
||||
),
|
||||
"account": getattr(token, "account_id", None) if token else None,
|
||||
"expires_at": expires_at,
|
||||
"login_supported": True,
|
||||
|
||||
Reference in New Issue
Block a user