{"version":"2.1.312","anchor":"sdk-oauth-401-recovery-only-swaps-the-token-when-it-differs","canonical_anchor":"sdk-oauth-401-recovery-only-swaps-the-token-when-it-differs","heading":"SDK sign-in recovery only swaps the token when it is actually new","tier":"notice","area":"SDK","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.312\/e\/sdk-oauth-401-recovery-only-swaps-the-token-when-it-differs","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.312","markdown":"### SDK sign-in recovery only swaps the token when it is actually new\n\nAfter a sign-in failure, Claude Code now applies the token from the SDK callback only if it differs from the one already in use\n\n**What**\n\nThe SDK is the kit for building programs on top of Claude Code. A program built with it can supply a `getOAuthToken` callback that hands Claude Code a sign-in token. When a request fails because the sign-in was rejected, Claude Code asks this callback for a token.\n\nClaude Code now compares the returned token with the one already in use. That can be `CLAUDE_CODE_OAUTH_TOKEN`, the stored token, or the token that failed. It sets `CLAUDE_CODE_OAUTH_TOKEN` and clears its saved credentials only when the new token is different. Before, it always did both. The recovery is still reported either way.\n\n**Why**\n\nWhen the callback hands back the same token, Claude Code no longer resets its saved credentials for no reason.\n\n- Area: SDK\n- Names: `getOAuthToken`\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: no"}