Skip to content

Invalid code when logging in with Claude Pro #428

Closed

Description

@blytheaw

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?

Activity

  1. thdxr commented on Jun 26, 2025

    @thdxr
    Member

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

  2. blytheaw commented on Jun 26, 2025

    @blytheaw
    Author

    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.

  3. self-assigned this
    on Jun 26, 2025
  4. thdxr commented on Jun 26, 2025

    @thdxr
    Member

    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

  5. citypaul commented on Jul 2, 2025

    @citypaul

    I'm seeing this same issue at the moment.

    Image
  6. citypaul commented on Jul 2, 2025

    @citypaul

    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?

  7. blytheaw commented on Jul 2, 2025

    @blytheaw
    Author

    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?

  8. thdxr commented on Jul 3, 2025

    @thdxr
    Member

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

  9. blytheaw commented on Jul 3, 2025

    @blytheaw
    Author

    @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.

  10. bkilshaw commented on Jul 4, 2025

    @bkilshaw

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

    Image
  11. added a commit that references this issue on Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions