OAuth / OAuth/Auth

OAuth token expired or revoked - AI coding tools and MCP

A local tool or MCP server is trying to use an OAuth credential that the provider no longer accepts.

OAuth token expired MCPOAuth token revoked AI coding toolinvalid_grant MCP
Paste an error to match it against the wiki. / 粘贴报错后自动匹配。

Error text / 报错原文

  • OAuth token expired
  • OAuth token revoked
  • invalid_grant
  • invalid_token

What it means

A local tool or MCP server is trying to use an OAuth credential that the provider no longer accepts.

Most common causes

  • Token lifetime expired
  • User revoked app access
  • Password or SSO policy changed
  • Refresh token stored for a different client or account

Fastest fix

  • Reauthenticate the affected tool
  • Clear only that tool/server auth entry
  • Confirm the active browser account
  • Retry with a fresh session

Safe fix

  • Use official OAuth flows
  • Store tokens in OS keychain or tool-managed files
  • Use service accounts for automation where supported
  • Audit token scopes periodically

What not to do

  • Do not share refresh tokens in issue reports
  • Do not copy tokens between machines
  • Do not bypass SSO policy with personal accounts

How to confirm the fix

Run the smallest reproducible command first, then retry the agent task only after authentication, quota, and tool discovery are stable.

date -u
env | grep -i token
git config --global --get credential.helper

Related errors

Related tools

Sources