anomalyco / anomalyco/opencode

Web and desktop clients cannot authenticate with Unicode server credentials

Open
#46,224 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 30, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

The web and desktop clients pass username:password directly to btoa() when creating a Basic-auth token. btoa() accepts only binary strings, so credentials containing characters outside the one-byte range throw InvalidCharacterError. Characters such as ä do not throw, but are encoded as a single byte instead of UTF-8, so the server decodes a different password and rejects authentication.

This affects server health checks, protocol detection, API clients, and legacy terminal authentication because they share the same credential encoder. The server already generates and decodes Basic-auth credentials as UTF-8. The app should convert the credential string to UTF-8 bytes before applying standard Base64 encoding.

Plugins

N/A

OpenCode version

N/A (reproduced in the shared client authentication helper)

Steps to reproduce
  1. Start an OpenCode server with OPENCODE_SERVER_PASSWORD='秘密🔐'.
  2. Open the web or desktop client and add that server.
  3. Enter the same password and attempt to connect.
  4. Observe that encoding throws InvalidCharacterError and the connection cannot be established.

A second case is päss: encoding does not throw, but the server receives invalid UTF-8 and authentication fails.

Expected behavior: Unicode usernames and passwords should be encoded as UTF-8 bytes before Base64 encoding and should authenticate successfully.

Screenshot and/or share link

Not provided; the credential helper provides a deterministic reproduction.

Operating System

All

Terminal

Web and desktop clients

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.