Summary #
- Persist the loopback OAuth
client_id/ callback URL on the keyring account at login. - Restore that identity before
ResumeSession, so token refresh uses the same localhost client that minted the grant. - Keep those fields across token refresh, and stop mapping
invalid_client_metadatato "Session expired".
ATProto localhost clients encode the redirect URI in client_id. tg auth login binds an ephemeral port, then later processes reconstructed NewLocalhostConfig("") and sent redirect_uri= on refresh. Bluesky returned HTTP 400 invalid_client_metadata, and tg auth status reported the still-present session as expired.
Existing sessions still need one tg auth login after this lands so the client identity is stored.
Test plan #
"There are only two hard things in Computer Science: cache invalidation and naming things." - Phil Karlton
Written by Cameron ◯ Letta Code