<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rokeyxuhleremny1</title>
    <description>The latest articles on DEV Community by rokeyxuhleremny1 (@rokeyxuhleremny1).</description>
    <link>https://dev.to/rokeyxuhleremny1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3835874%2Ff06fa6d9-2b97-4f6c-a83a-4b42a33c2593.png</url>
      <title>DEV Community: rokeyxuhleremny1</title>
      <link>https://dev.to/rokeyxuhleremny1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rokeyxuhleremny1"/>
    <language>en</language>
    <item>
      <title>Fixing "invalid token" in OpenCode: A Working Claude (Anthropic) OAuth Solution</title>
      <dc:creator>rokeyxuhleremny1</dc:creator>
      <pubDate>Fri, 20 Mar 2026 17:48:02 +0000</pubDate>
      <link>https://dev.to/rokeyxuhleremny1/-fixing-invalid-token-in-opencode-a-working-claude-anthropic-oauth-solution-2jno</link>
      <guid>https://dev.to/rokeyxuhleremny1/-fixing-invalid-token-in-opencode-a-working-claude-anthropic-oauth-solution-2jno</guid>
      <description>&lt;p&gt;If you're using OpenCode with Anthropic’s Claude and suddenly started seeing errors like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;invalid token&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;authentication failed&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;unauthorized request&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You're not alone.&lt;/p&gt;

&lt;p&gt;But here's the good news — there &lt;em&gt;is&lt;/em&gt; a working solution, and you can get everything running again in just a couple of minutes.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 The Solution (Works Right Now)
&lt;/h2&gt;

&lt;p&gt;I built a small open-source plugin that restores Claude access inside OpenCode using OAuth:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://github.com/rokeyxuhleremny1/invalid-token-opencode" rel="noopener noreferrer"&gt;https://github.com/rokeyxuhleremny1/invalid-token-opencode&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What it does
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Lets you log in with your Claude Pro / Max account&lt;/li&gt;
&lt;li&gt;Restores access to all Anthropic models&lt;/li&gt;
&lt;li&gt;Fixes broken token flows&lt;/li&gt;
&lt;li&gt;Requires no Claude Code installation&lt;/li&gt;
&lt;li&gt;Handles authentication automatically&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚡ Quick Setup
&lt;/h2&gt;

&lt;p&gt;Install the plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; opencode-anthropic-oauth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add it to your config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"plugin"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"opencode-anthropic-oauth"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/connect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;oc auth login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Select:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Anthropic → Claude Pro/Max
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Complete the browser login → paste the code → done.&lt;/p&gt;

&lt;p&gt;✅ Claude is working again.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 How It Works
&lt;/h2&gt;

&lt;p&gt;Instead of relying on broken token handling, this plugin:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses OAuth (PKCE flow)&lt;/li&gt;
&lt;li&gt;Authenticates via browser (secure login)&lt;/li&gt;
&lt;li&gt;Exchanges auth code for access + refresh tokens&lt;/li&gt;
&lt;li&gt;Automatically refreshes tokens&lt;/li&gt;
&lt;li&gt;Injects correct API headers into OpenCode&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Result: stable, working integration with Anthropic again.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔑 Alternative Option
&lt;/h2&gt;

&lt;p&gt;If you want something more “official”:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Anthropic API keys&lt;/li&gt;
&lt;li&gt;Pay-as-you-go&lt;/li&gt;
&lt;li&gt;No dependency on subscription tokens&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But for many users, OAuth is the fastest way to get back up and running.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚠️ Important Disclaimer
&lt;/h2&gt;

&lt;p&gt;This solution uses Anthropic’s public OAuth client.&lt;/p&gt;

&lt;p&gt;According to their Terms of Service (Feb 2026):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subscription tokens are intended for official clients only&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a &lt;strong&gt;community workaround&lt;/strong&gt; and may stop working if things change.&lt;/p&gt;




&lt;h2&gt;
  
  
  💥 What Actually Happened (Why Everything Broke)
&lt;/h2&gt;

&lt;p&gt;Recently, Anthropic changed how authentication works.&lt;/p&gt;

&lt;p&gt;This caused:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenCode integrations to fail&lt;/li&gt;
&lt;li&gt;Tokens from Claude Pro/Max to stop working&lt;/li&gt;
&lt;li&gt;Massive “invalid token” errors across the community&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short:&lt;/p&gt;

&lt;p&gt;👉 You could no longer use your subscription tokens outside official tools.&lt;/p&gt;

&lt;p&gt;This broke workflows for a lot of developers using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenCode&lt;/li&gt;
&lt;li&gt;Cursor&lt;/li&gt;
&lt;li&gt;custom clients&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧾 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;AI tooling is moving fast — and sometimes platforms lock things down.&lt;/p&gt;

&lt;p&gt;When that happens, the community adapts.&lt;/p&gt;

&lt;p&gt;This plugin is one of those adaptations — simple, practical, and working &lt;em&gt;right now&lt;/em&gt;.&lt;/p&gt;




&lt;p&gt;If this helped you, feel free to ⭐ the repo:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://github.com/rokeyxuhleremny1/invalid-token-opencode" rel="noopener noreferrer"&gt;https://github.com/rokeyxuhleremny1/invalid-token-opencode&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
