Skip to content

Commit 7bdd851

Browse files
authored
fix: stop reading WORKOS_CLIENT_ID for CLI auth (#113)
The CLI's device auth flow read WORKOS_CLIENT_ID from the environment to resolve its OAuth client ID. This collides with the same env var that every WorkOS-integrated app sets for its own client ID, causing 401 errors on `workos auth login` when the user's app client ID lacks the device_code grant type. The CLI's auth client ID is a fixed value — hardcode it directly instead of reading from the environment.
1 parent effe187 commit 7bdd851

4 files changed

Lines changed: 1 addition & 11 deletions

File tree

src/commands/debug.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ interface EnvVarInfo {
322322

323323
const ENV_VAR_CATALOG: { name: string; effect: string }[] = [
324324
{ name: 'WORKOS_API_KEY', effect: 'Bypasses credential resolution — used directly for API calls' },
325-
{ name: 'WORKOS_CLIENT_ID', effect: 'Overrides client ID from settings' },
326325
{ name: 'WORKOS_FORCE_TTY', effect: 'Forces human (non-JSON) output mode, even when piped' },
327326
{ name: 'WORKOS_NO_PROMPT', effect: 'Forces non-interactive/JSON mode' },
328327
{ name: 'WORKOS_TELEMETRY', effect: 'Set to "false" to disable telemetry' },

src/commands/login.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,6 @@ export async function provisionStagingEnvironment(accessToken: string): Promise<
106106
export async function runLogin(): Promise<void> {
107107
const clientId = getCliAuthClientId();
108108

109-
if (!clientId) {
110-
clack.log.error('CLI auth not configured. Set WORKOS_CLI_CLIENT_ID environment variable.');
111-
process.exit(1);
112-
}
113-
114109
// Check if already logged in with valid token
115110
if (getAccessToken()) {
116111
const creds = getCredentials();

src/lib/run-with-core.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,6 @@ export async function runWithCore(options: InstallerOptions): Promise<void> {
329329
const clientId = getCliAuthClientId();
330330
const authkitDomain = getAuthkitDomain();
331331

332-
if (!clientId) {
333-
throw new Error('CLI auth not configured. Set WORKOS_CLI_CLIENT_ID environment variable.');
334-
}
335-
336332
const deviceAuth = await requestDeviceCode({
337333
clientId,
338334
authkitDomain,

src/lib/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function getConfig(): InstallerConfig {
6060
* Env var overrides config default.
6161
*/
6262
export function getCliAuthClientId(): string {
63-
return process.env.WORKOS_CLIENT_ID || config.workos.clientId;
63+
return config.workos.clientId;
6464
}
6565

6666
/**

0 commit comments

Comments
 (0)