@devries-cameron20 / t3code-1 / commits / 1b4830ff06
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(desktop): restore T3 Connect sign-in (#4809)

Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Alex committed Jul 29, 2026 at 01:59 UTC 1b4830ff06bf80e505dbf669deef189af85f77d7
4 files changed +40 -3
apps/web/src/components/clerk/authRedirect.test.ts new
+18
@@ -0,0 +1,18 @@
1 +import { describe, expect, it } from "vite-plus/test";
2 +
3 +import { resolveClerkSignInProps } from "./authRedirect";
4 +
5 +describe("resolveClerkSignInProps", () => {
6 + it("returns to the current browser URL on the web", () => {
7 + const href = "https://app.t3.codes/connect?state=state-1#details";
8 + expect(resolveClerkSignInProps(href, false)).toEqual({ forceRedirectUrl: href });
9 + });
10 +
11 + it("omits the redirect override on packaged desktop", () => {
12 + expect(resolveClerkSignInProps("t3code://app/#/settings/general", true)).toEqual({});
13 + });
14 +
15 + it("omits the redirect override on development desktop", () => {
16 + expect(resolveClerkSignInProps("t3code-dev://app/#/settings/general", true)).toEqual({});
17 + });
18 +});
apps/web/src/components/clerk/authRedirect.ts new
+12
@@ -0,0 +1,12 @@
1 +export interface ClerkSignInProps {
2 + forceRedirectUrl?: string;
3 +}
4 +
5 +// Clerk's native-app allowlist only authorizes the bare renderer root
6 +// (t3code://app/), which @clerk/electron's OAuth transport already supplies,
7 +// so any page-derived redirect override gets the whole sign-in request
8 +// rejected. On Electron, omit the override and let Clerk use its defaults.
9 +export function resolveClerkSignInProps(href: string, isElectron: boolean): ClerkSignInProps {
10 + if (isElectron) return {};
11 + return { forceRedirectUrl: href };
12 +}
apps/web/src/components/clerk/useT3ConnectAuthPrompt.tsx
+4 -1
@@ -1,9 +1,12 @@
1 import { useClerk } from "@clerk/react";
2
3 +import { isElectron } from "../../env";
4 +import { resolveClerkSignInProps } from "./authRedirect";
5 +
6 export function useT3ConnectAuthPrompt() {
7 const clerk = useClerk();
8 const openAuthPrompt = () => {
6 - clerk.openSignIn({ forceRedirectUrl: window.location.href });
9 + clerk.openSignIn(resolveClerkSignInProps(window.location.href, isElectron));
10 };
11 return { authPrompt: null, openAuthPrompt };
12 }
apps/web/src/components/cloud/ConnectCliAuthSurface.tsx
+6 -2
@@ -8,8 +8,10 @@ import {
8 readConnectCliCallbackResult,
9 rememberConnectCliAuthState,
10 } from "../../cloud/connectCliAuth";
11 +import { isElectron } from "../../env";
12 import { useCopyToClipboard } from "../../hooks/useCopyToClipboard";
13 import { AuthSurfaceShell } from "../auth/AuthSurfaceShell";
14 +import { resolveClerkSignInProps } from "../clerk/authRedirect";
15 import { Button } from "../ui/button";
16
17 function ConnectCliAuthMessage({
@@ -59,7 +61,7 @@ export function ConnectCliAuthorizeSurface() {
61 if (!isSignedIn) {
62 if (!signInOpened.current) {
63 signInOpened.current = true;
62 - clerk.openSignIn({ forceRedirectUrl: window.location.href });
64 + clerk.openSignIn(resolveClerkSignInProps(window.location.href, isElectron));
65 }
66 return;
67 }
@@ -95,7 +97,9 @@ export function ConnectCliAuthorizeSurface() {
97 <div className="mt-6">
98 <Button
99 type="button"
98 - onClick={() => clerk.openSignIn({ forceRedirectUrl: window.location.href })}
100 + onClick={() =>
101 + clerk.openSignIn(resolveClerkSignInProps(window.location.href, isElectron))
102 + }
103 >
104 Sign in
105 </Button>