-
Notifications
You must be signed in to change notification settings - Fork 567
fix(auth): Improve OAuth credential detection and startup warning #747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
aad3ff2
0aef725
ad6ce73
d4f68b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| import type { Request, Response } from 'express'; | ||
| import { query } from '@anthropic-ai/claude-agent-sdk'; | ||
| import { createLogger } from '@automaker/utils'; | ||
| import { getClaudeAuthIndicators } from '@automaker/platform'; | ||
| import { getApiKey } from '../common.js'; | ||
| import { | ||
| createSecureAuthEnv, | ||
|
|
@@ -320,9 +321,27 @@ export function createVerifyClaudeAuthHandler() { | |
| authMethod, | ||
| }); | ||
|
|
||
| // Determine specific auth type for success messages | ||
| let authType: 'oauth' | 'api_key' | 'cli' | undefined; | ||
| if (authenticated) { | ||
| if (authMethod === 'api_key') { | ||
| authType = 'api_key'; | ||
| } else if (authMethod === 'cli') { | ||
| // Check if CLI auth is via OAuth (Claude Code subscription) or generic CLI | ||
| try { | ||
| const indicators = await getClaudeAuthIndicators(); | ||
| authType = indicators.credentials?.hasOAuthToken ? 'oauth' : 'cli'; | ||
| } catch { | ||
| // Fall back to generic CLI if credential check fails | ||
| authType = 'cli'; | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+324
to
+339
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check how the UI consumes authType from the verify-claude-auth response
rg -n -C5 'authType' --type=ts --type=tsx -g '!node_modules/**' -g '!dist/**'Repository: AutoMaker-Org/automaker Length of output: 94 🏁 Script executed: #!/bin/bash
# Search for authType usage with correct rg syntax
rg -n -C5 'authType' --type=ts -g '!node_modules/**' -g '!dist/**'Repository: AutoMaker-Org/automaker Length of output: 13252 🏁 Script executed: #!/bin/bash
# Get the full context of the verify-claude-auth route to understand authMethod handling
cat -n apps/server/src/routes/setup/routes/verify-claude-auth.ts | head -200Repository: AutoMaker-Org/automaker Length of output: 8378 🏁 Script executed: #!/bin/bash
# Continue reading the verify-claude-auth.ts file to see the rest of the logic
cat -n apps/server/src/routes/setup/routes/verify-claude-auth.ts | tail -n +200Repository: AutoMaker-Org/automaker Length of output: 7518 When In auto-detect mode (no The UI handler in Consider checking credentials in auto-detect mode similarly to how it's done for the 🤖 Prompt for AI Agents |
||
|
|
||
| res.json({ | ||
| success: true, | ||
| authenticated, | ||
| authType, | ||
| error: errorMessage || undefined, | ||
| }); | ||
| } catch (error) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.