anthropic auth proxy for multi-user claude code
Local HTTP proxy on 127.0.0.1:5051 intercepts Claude Code API requests from sandboxed member users, injects the real OAuth token server-side, and forwards to Anthropic. Users only see a proxy secret, never the real credentials. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,9 +56,11 @@ claudeCodeRouter.get('/auth', async (ctx) => {
|
||||
const proc = Bun.spawn(['claude', 'auth', 'status'], { stdout: 'pipe', stderr: 'pipe' });
|
||||
const output = await new Response(proc.stdout).text();
|
||||
await proc.exited;
|
||||
if (proc.exitCode !== 0) return ctx.json({ authenticated: false });
|
||||
const status = JSON.parse(output.trim());
|
||||
return ctx.json({ authenticated: status.loggedIn ?? false, ...status });
|
||||
if (proc.exitCode === 0) {
|
||||
const status = JSON.parse(output.trim());
|
||||
if (status.loggedIn) return ctx.json({ authenticated: true, ...status });
|
||||
}
|
||||
return ctx.json({ authenticated: false });
|
||||
} catch {
|
||||
return ctx.json({ authenticated: false });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user