mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
fix(auth): Improve OAuth credential detection and startup warning
- Enhanced getClaudeAuthIndicators() to return detailed check information including file paths checked and specific error details for debugging - Added debug logging to server startup credential detection for easier troubleshooting in Docker environments - Show paths that were checked in the warning message to help users debug mount issues - Added support for CLAUDE_CODE_OAUTH_TOKEN environment variable - Return authType in verify-claude-auth response to distinguish between OAuth and CLI authentication methods - Updated UI to show specific success messages for Claude Code subscription vs generic CLI auth - Added Docker troubleshooting tips to sandbox risk dialog - Added comprehensive unit tests for OAuth credential detection scenarios Closes #721 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,29 @@ export function SandboxRiskDialog({ open, onConfirm, onDeny }: SandboxRiskDialog
|
||||
For safer operation, consider running Automaker in Docker. See the README for
|
||||
instructions.
|
||||
</p>
|
||||
|
||||
<div className="bg-muted/50 border border-border rounded-lg p-4 space-y-2">
|
||||
<p className="text-sm font-medium text-foreground">
|
||||
Already running in Docker? Try these troubleshooting steps:
|
||||
</p>
|
||||
<ul className="text-sm text-muted-foreground list-disc list-inside space-y-1">
|
||||
<li>
|
||||
Ensure <code className="bg-muted px-1 rounded">IS_CONTAINERIZED=true</code> is
|
||||
set in your docker-compose environment
|
||||
</li>
|
||||
<li>
|
||||
Verify the server container has the environment variable:{' '}
|
||||
<code className="bg-muted px-1 rounded">
|
||||
docker exec automaker-server printenv IS_CONTAINERIZED
|
||||
</code>
|
||||
</li>
|
||||
<li>Rebuild and restart containers if you recently changed the configuration</li>
|
||||
<li>
|
||||
Check the server logs for startup messages:{' '}
|
||||
<code className="bg-muted px-1 rounded">docker-compose logs server</code>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -59,6 +59,7 @@ export function ClaudeSetupStep({ onNext, onBack, onSkip }: ClaudeSetupStepProps
|
||||
// CLI Verification state
|
||||
const [cliVerificationStatus, setCliVerificationStatus] = useState<VerificationStatus>('idle');
|
||||
const [cliVerificationError, setCliVerificationError] = useState<string | null>(null);
|
||||
const [cliAuthType, setCliAuthType] = useState<'oauth' | 'cli' | null>(null);
|
||||
|
||||
// API Key Verification state
|
||||
const [apiKeyVerificationStatus, setApiKeyVerificationStatus] =
|
||||
@@ -119,6 +120,7 @@ export function ClaudeSetupStep({ onNext, onBack, onSkip }: ClaudeSetupStepProps
|
||||
const verifyCliAuth = useCallback(async () => {
|
||||
setCliVerificationStatus('verifying');
|
||||
setCliVerificationError(null);
|
||||
setCliAuthType(null);
|
||||
|
||||
try {
|
||||
const api = getElectronAPI();
|
||||
@@ -138,12 +140,21 @@ export function ClaudeSetupStep({ onNext, onBack, onSkip }: ClaudeSetupStepProps
|
||||
|
||||
if (result.authenticated && !hasLimitReachedError) {
|
||||
setCliVerificationStatus('verified');
|
||||
// Store the auth type for displaying specific success message
|
||||
const authType = result.authType === 'oauth' ? 'oauth' : 'cli';
|
||||
setCliAuthType(authType);
|
||||
setClaudeAuthStatus({
|
||||
authenticated: true,
|
||||
method: 'cli_authenticated',
|
||||
method: authType === 'oauth' ? 'oauth_token' : 'cli_authenticated',
|
||||
hasCredentialsFile: claudeAuthStatus?.hasCredentialsFile || false,
|
||||
oauthTokenValid: authType === 'oauth',
|
||||
});
|
||||
toast.success('Claude CLI authentication verified!');
|
||||
// Show specific success message based on auth type
|
||||
if (authType === 'oauth') {
|
||||
toast.success('Claude Code subscription detected and verified!');
|
||||
} else {
|
||||
toast.success('Claude CLI authentication verified!');
|
||||
}
|
||||
} else {
|
||||
setCliVerificationStatus('error');
|
||||
setCliVerificationError(
|
||||
@@ -436,9 +447,15 @@ export function ClaudeSetupStep({ onNext, onBack, onSkip }: ClaudeSetupStepProps
|
||||
<div className="flex items-center gap-3 p-4 rounded-lg bg-green-500/10 border border-green-500/20">
|
||||
<CheckCircle2 className="w-5 h-5 text-green-500" />
|
||||
<div>
|
||||
<p className="font-medium text-foreground">CLI Authentication verified!</p>
|
||||
<p className="font-medium text-foreground">
|
||||
{cliAuthType === 'oauth'
|
||||
? 'Claude Code subscription verified!'
|
||||
: 'CLI Authentication verified!'}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Your Claude CLI is working correctly.
|
||||
{cliAuthType === 'oauth'
|
||||
? 'Your Claude Code subscription is active and ready to use.'
|
||||
: 'Your Claude CLI is working correctly.'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1442,6 +1442,7 @@ interface SetupAPI {
|
||||
verifyClaudeAuth: (authMethod?: 'cli' | 'api_key') => Promise<{
|
||||
success: boolean;
|
||||
authenticated: boolean;
|
||||
authType?: 'oauth' | 'api_key' | 'cli';
|
||||
error?: string;
|
||||
}>;
|
||||
getGhStatus?: () => Promise<{
|
||||
|
||||
@@ -1350,6 +1350,7 @@ export class HttpApiClient implements ElectronAPI {
|
||||
): Promise<{
|
||||
success: boolean;
|
||||
authenticated: boolean;
|
||||
authType?: 'oauth' | 'api_key' | 'cli';
|
||||
error?: string;
|
||||
}> => this.post('/api/setup/verify-claude-auth', { authMethod, apiKey }),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user