Invalid code when logging in with Claude Pro #310

Closed
opened 2026-02-16 17:26:09 -05:00 by yindo · 9 comments
Owner

Originally created by @blytheaw on GitHub (Jun 26, 2025).

Originally assigned to: @thdxr on GitHub.

I'm trying to get started with opencode. When I try to login with my Claude Pro account, i get an error "Invalid code" after pasting the auth token into my terminal. The steps I'm performing:

  1. opencode auth login
  2. Select Anthropic
  3. Select Claude Pro/Max (my browser opens for OAuth flow)
  4. I click Authorize on claude.ai consent screen
  5. I'm redirected to console.anthropic.com and presented with a code
  6. I copy the code and paste back into terminal

I get the below error:

Image

What am I missing here?

Originally created by @blytheaw on GitHub (Jun 26, 2025). Originally assigned to: @thdxr on GitHub. I'm trying to get started with opencode. When I try to login with my Claude Pro account, i get an error "Invalid code" after pasting the auth token into my terminal. The steps I'm performing: 1. `opencode auth login` 2. Select Anthropic 3. Select Claude Pro/Max (my browser opens for OAuth flow) 4. I click Authorize on claude.ai consent screen 5. I'm redirected to console.anthropic.com and presented with a code 6. I copy the code and paste back into terminal I get the below error: ![Image](https://github.com/user-attachments/assets/4f9f6ec0-8d89-4082-b8d7-17534cb38071) What am I missing here?
yindo closed this issue 2026-02-16 17:26:09 -05:00
Author
Owner

@thdxr commented on GitHub (Jun 26, 2025):

hm it's working for me - can anyone else confirm the issue?

@thdxr commented on GitHub (Jun 26, 2025): hm it's working for me - can anyone else confirm the issue?
Author
Owner

@blytheaw commented on GitHub (Jun 26, 2025):

Is there some relationship between claude.ai accounts and console.anthropic.com accounts? Mine seem independent even though I'm using the same email for both. I actually used Google auth with both of them.

I originally signed up on claude.ai for a free account with a Google login. I then upgraded to Claude Pro. (I still did not have a console.anthropic.com account at this point).

I created a console.anthropic.com account while troubleshooting this issue, also using Google login. As far as I can tell this has no link to the claude.ai account.

@thdxr Not sure if any of this information helps shed light on what could be going on.

@blytheaw commented on GitHub (Jun 26, 2025): Is there some relationship between claude.ai accounts and console.anthropic.com accounts? Mine seem independent even though I'm using the same email for both. I actually used Google auth with both of them. I originally signed up on claude.ai for a free account with a Google login. I then upgraded to Claude Pro. (I still did not have a console.anthropic.com account at this point). I created a console.anthropic.com account while troubleshooting this issue, also using Google login. As far as I can tell this has no link to the claude.ai account. @thdxr Not sure if any of this information helps shed light on what could be going on.
Author
Owner

@thdxr commented on GitHub (Jun 26, 2025):

yeah we've seen this - console.anthropic.com accounts seem to be treated totally differently. they can't have pro/max acocunts but i've heard they're fixing this

but i'm not sure why this means your code is invalid

@thdxr commented on GitHub (Jun 26, 2025): yeah we've seen this - console.anthropic.com accounts seem to be treated totally differently. they can't have pro/max acocunts but i've heard they're fixing this<br><br>but i'm not sure why this means your code is invalid
Author
Owner

@citypaul commented on GitHub (Jul 2, 2025):

I'm seeing this same issue at the moment.

Image
@citypaul commented on GitHub (Jul 2, 2025): I'm seeing this same issue at the moment. <img width="393" alt="Image" src="https://github.com/user-attachments/assets/9e120266-5748-4c46-a382-c9c9da562406" />
Author
Owner

@citypaul commented on GitHub (Jul 2, 2025):

I'm not sure how this works under the hood, but I can tell you there's an aggressive z-scaler setup on the machine I'm using here. I was able to actually go through the oauth flow on the anthropic side and get the token though. Could it be related to z-scaler at all?

@citypaul commented on GitHub (Jul 2, 2025): I'm not sure how this works under the hood, but I can tell you there's an aggressive z-scaler setup on the machine I'm using here. I was able to actually go through the oauth flow on the anthropic side and get the token though. Could it be related to z-scaler at all?
Author
Owner

@blytheaw commented on GitHub (Jul 2, 2025):

I was able to get it working with no issue on my personal laptop (Arch Linux, opencode installed from AUR) with the same Claude account.

My work machine (Macbook Pro) is where it isn't working, and an additional variable here is a company VPN (ZScaler). Zcaler does SSL inspection and often we have to explicitly set custom CA certificates for various tooling in order for things to work. Is that an option here?

@blytheaw commented on GitHub (Jul 2, 2025): I was able to get it working with no issue on my personal laptop (Arch Linux, opencode installed from AUR) with the same Claude account. My work machine (Macbook Pro) is where it isn't working, and an additional variable here is a company VPN (ZScaler). Zcaler does SSL inspection and often we have to explicitly set custom CA certificates for various tooling in order for things to work. Is that an option here?
Author
Owner

@thdxr commented on GitHub (Jul 3, 2025):

if you add the node env for ca cert does it work? NODE_EXTRA_CA_CERTS=/path/

@thdxr commented on GitHub (Jul 3, 2025): if you add the node env for ca cert does it work? NODE_EXTRA_CA_CERTS=/path/
Author
Owner

@blytheaw commented on GitHub (Jul 3, 2025):

@thdxr No I have that exported already in my system for other Node-based tooling and it still doesn't work.

However, I just tried exporting the standard SSL_CERT_FILE environment variable and providing the path to my company's CA cert bundle, and this worked.

This might be a good general recommendation for those users behind corporate proxies/VPNs that do SSL inspection.

@blytheaw commented on GitHub (Jul 3, 2025): @thdxr No I have that exported already in my system for other Node-based tooling and it still doesn't work. However, I just tried exporting the standard SSL_CERT_FILE environment variable and providing the path to my company's CA cert bundle, and this worked. This might be a good general recommendation for those users behind corporate proxies/VPNs that do SSL inspection.
Author
Owner

@bkilshaw commented on GitHub (Jul 4, 2025):

I'm running into the same issue here and I'm not connected to a VPN.

Image
@bkilshaw commented on GitHub (Jul 4, 2025): I'm running into the same issue here and I'm not connected to a VPN. <img width="622" height="952" alt="Image" src="https://github.com/user-attachments/assets/839a4b34-3cda-42d2-8f57-a6fb5523b62c" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#310