Follow Discord
Sweep 27 Oct 2026 · 19:04Z Build v2.1.312 531 read Stable v2.1.308 Latest v2.1.312 Next v2.1.312 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.311 ·

SDK hosts can hand Claude Code a separate cloud-sessions token

Apps embedding Claude Code can now supply a second token for the cloud-sessions API via CLAUDE_CODE_SESSIONS_OAUTH_TOKEN or a sessions refresh request

Group of 3 Use it now Notable No documentation found New Features
JSON All of v2.1.311
Use it nowTier: how much it should matter to you
5Useful: my rating, 1 to 5
3Signal: worth watching, 1 to 5
SDKArea: what it touches
New FeaturesKind: in v2.1.311,
What probably matters to youSection of the release

Unclear It is not clear when the check accepts CLAUDE_CODE_SESSIONS_OAUTH_TOKEN, so whether it takes effect is unknown.

What

An SDK host is an app that runs Claude Code inside itself through the Agent SDK. Such a host could already refresh Claude Code's sign-in token. It can now also supply a second token that authorizes the cloud-sessions API. That token must belong to the same account and organization as the sign-in token.

  • CLAUDE_CODE_SESSIONS_OAUTH_TOKEN is a new environment variable holding that token. It is added to three credential lists, and one of them strips secrets from the environment.
  • When a host sends this variable through update_environment_variables, the value is held back and applied only if a validity check passes. Otherwise it goes on the list of refused keys. The handling of CLAUDE_CODE_OAUTH_TOKEN in the same place was reworked to refresh credentials after the update.
  • The oauth_token_refresh request gains an optional kind: "sessions" that asks the host for the cloud-sessions token. Without kind, the request still means the sign-in token, which is all that older hosts know.
  • CLAUDE_CODE_SDK_HAS_SESSIONS_OAUTH_REFRESH is a new variable a host sets to say it can answer that request. It also turns on the same behaviour as CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH.
  • Claude Code can now ask when it first needs the token. Before, the request was sent only after a 401 (a rejected request) when there was no local refresh token.
  • If the host answers with the sign-in token instead, the answer is ignored with a warning, and cloud-sessions calls keep using the sign-in token.

This path runs only when the host sets the new variable, Claude Code was started in a way that allows host refresh, and one further check passes.

Why

Apps that embed Claude Code can give it a separate token just for cloud sessions, and that token is treated as a secret. Without a host that sets the new variable, nothing changes.

Read from
How sure we are
Something disagreesSomething we can check disagrees with this entry, or the writer said they could not settle it.
The writer flagged doubtIt is not clear when the check accepts `CLAUDE_CODE_SESSIONS_OAUTH_TOKEN`, so whether it takes effect is unknown.
The name it cites is new in this buildNew in this build: CLAUDE_CODE_SESSIONS_OAUTH_TOKEN

See this entry in the whole of v2.1.311 →

Feedback