You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 41e519a
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/internals/t3-connect.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,9 +90,17 @@ In **Clerk Dashboard > OAuth applications**:
90
90
5. Set `T3CODE_CLERK_CLI_OAUTH_CLIENT_ID` in the repository-root `.env` file and release build
91
91
environment to the generated public client ID.
92
92
93
-
The CLI derives Clerk's frontend API URL from the publishable key and calls Clerk's
94
-
`/oauth/authorize` and `/oauth/token` endpoints directly. The relay is not involved in the OAuth
95
-
handshake; it only validates the issued Clerk bearer token when the CLI manages an environment link.
93
+
Both CLI flows start at the hosted `/connect` page (`buildConnectAuthorizeRequestUrl` in
94
+
`packages/shared/src/connectAuth.ts`), which waits for a Clerk session and then forwards the request
95
+
to Clerk's `/oauth/authorize`. The CLI never opens `/oauth/authorize` directly: a signed-out browser
96
+
sent there goes through Clerk's sign-in redirect, which drops the authorize query parameters and
97
+
fails the flow with `unsupported_response_type` or an empty `state` (#5051). The loopback flow marks
98
+
the request with a `port` fragment parameter so the hosted page asks Clerk to redirect the
99
+
authorization code straight to `http://127.0.0.1:<port>/callback`; the out-of-band flow omits it and
100
+
uses the hosted `/connect/callback` page instead. The CLI derives Clerk's frontend API URL from the
101
+
publishable key and calls only the `/oauth/token` endpoint directly. The relay is not involved in
102
+
the OAuth handshake; it only validates the issued Clerk bearer token when the CLI manages an
* Present when a loopback CLI initiated the request: the hosted /connect
30
+
* page then asks Clerk to redirect the authorization code straight to
31
+
* `http://127.0.0.1:<port>/callback` instead of the hosted callback page.
32
+
*/
33
+
readonlyloopbackPort?: number;
26
34
}
27
35
28
36
/**
29
-
* The URL a headless CLI prints for the user to open on a machine with a
30
-
* browser. `state` and `code_challenge` ride the fragment so they never reach
31
-
* the hosted app's server or CDN logs; neither is a secret.
37
+
* The URL the CLI prints for the user to open in a browser. `state` and
38
+
* `code_challenge` ride the fragment so they never reach the hosted app's
39
+
* server or CDN logs; neither is a secret.
40
+
*
41
+
* Both CLI flows route through the hosted /connect page rather than hitting
42
+
* Clerk's /oauth/authorize directly: a signed-out browser sent straight to
43
+
* /oauth/authorize goes through Clerk's sign-in redirect, which does not
44
+
* reliably preserve the authorize query parameters (state, response_type,
45
+
* code_challenge). The hosted page waits for a Clerk session first, then
46
+
* forwards the request with the parameters intact.
0 commit comments