How to authenticate with OpenCode when running on a remote server via VS Code? #8483

Open
opened 2026-02-16 18:10:04 -05:00 by yindo · 3 comments
Owner

Originally created by @mensylisir on GitHub (Feb 3, 2026).

Originally assigned to: @jayair on GitHub.

Question

Description:

Hi there,
I am currently using OpenCode on a remote server. My setup involves connecting to the server from a local Windows machine using VS Code (Remote-SSH).
I would like to know how to complete the authentication process in this remote environment. Since I am accessing the server through a remote terminal/VS Code, the typical browser-based authentication flow might not work as expected.
Could you please provide guidance or the recommended steps for authentication in this specific setup?

Environment:

  • Local OS: Windows
  • IDE: VS Code (Remote Development)
  • Remote OS: Linux (Server)
  • Tool: OpenCode
    Thank you!
Originally created by @mensylisir on GitHub (Feb 3, 2026). Originally assigned to: @jayair on GitHub. ### Question #### Description: Hi there, I am currently using OpenCode on a remote server. My setup involves connecting to the server from a local Windows machine using VS Code (Remote-SSH). I would like to know how to complete the authentication process in this remote environment. Since I am accessing the server through a remote terminal/VS Code, the typical browser-based authentication flow might not work as expected. Could you please provide guidance or the recommended steps for authentication in this specific setup? #### Environment: - Local OS: Windows - IDE: VS Code (Remote Development) - Remote OS: Linux (Server) - Tool: OpenCode Thank you!
yindo added the docs label 2026-02-16 18:10:04 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 3, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #7114: Claude Pro/Max authentication not usable over SSH - discusses authentication challenges when running OpenCode on a remote server over SSH
  • #8795: Remote Development: Execute Code on Remote Server, but Route Model API Calls & Authentication via Local Machine - discusses similar remote development setup with authentication routing

Feel free to ignore if your specific use case differs from these issues.

@github-actions[bot] commented on GitHub (Feb 3, 2026): This issue might be a duplicate of existing issues. Please check: - #7114: Claude Pro/Max authentication not usable over SSH - discusses authentication challenges when running OpenCode on a remote server over SSH - #8795: Remote Development: Execute Code on Remote Server, but Route Model API Calls & Authentication via Local Machine - discusses similar remote development setup with authentication routing Feel free to ignore if your specific use case differs from these issues.
Author
Owner

@LeonMueller-OneAndOnly commented on GitHub (Feb 5, 2026):

What happens when you first

  • SSH into your server from your desktop
  • and run ˋopencodeˋ?
@LeonMueller-OneAndOnly commented on GitHub (Feb 5, 2026): What happens when you first - SSH into your server from your desktop - and run ˋopencodeˋ?
Author
Owner

@LeonMueller-OneAndOnly commented on GitHub (Feb 5, 2026):

For connecting the web ui to an opencode server, we can use SSH's port forwarding.

  1. start opencode on server
    opencode serve --hostname localhost --port 4096

  2. forward ssh port on desktop

ssh -L 4096:localhost:4096 user@myserver.com

📌 Meaning
-L → forward a local port
4096 → port on your local machine
localhost:4096 → address/port on the remote server
user@myserver.com → SSH login to the server

After running this command, open in your browser:
http://localhost:4096
You will see the remote app from myserver.com:4096.

@LeonMueller-OneAndOnly commented on GitHub (Feb 5, 2026): For connecting the web ui to an opencode server, we can use SSH's port forwarding. 1. start opencode on server opencode serve --hostname localhost --port 4096 2. forward ssh port on desktop ssh -L 4096:localhost:4096 user@myserver.com 📌 Meaning -L → forward a local port 4096 → port on your local machine localhost:4096 → address/port on the remote server user@myserver.com → SSH login to the server After running this command, open in your browser: http://localhost:4096 You will see the remote app from myserver.com:4096.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8483