Skip to content

Commit b896928

Browse files
committed
feat(auth): disable TUI authentication flow
Forces users to use CLI command 'opencode auth login' by detecting non-TTY environments. Prevents issues with TUI-based OAuth redirection.
1 parent b02df6e commit b896928

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,17 @@ while (attempted.size < Math.max(1, accountCount)) {
852852
* @returns Authorization flow configuration
853853
*/
854854
authorize: async (inputs?: Record<string, string>) => {
855+
// Detect if running in TUI/Non-interactive mode (OpenCode GUI)
856+
// We force CLI usage to ensure proper shell interaction for OAuth flow
857+
if (!process.stdout.isTTY) {
858+
return {
859+
url: "",
860+
instructions: "Authentication via UI is currently closed. Please use the command `opencode auth login` in your terminal instead.",
861+
method: "auto",
862+
callback: async () => ({ type: "failed" as const, reason: "unknown" as const, message: "UI auth disabled" }),
863+
};
864+
}
865+
855866
// Always use the multi-account flow regardless of inputs
856867
// The inputs parameter is only used for noBrowser flag, not for flow selection
857868
const accounts: TokenSuccess[] = [];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oc-chatgpt-multi-auth",
3-
"version": "4.9.3",
3+
"version": "4.9.6",
44
"description": "Multi-account rotation plugin for ChatGPT Plus/Pro (OAuth / Codex backend)",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

0 commit comments

Comments
 (0)