For Node.js applications (CLI tools, servers, etc.), use the Node.js-specific import for full functionality including file system access and automatic browser launching.
import { ClaudeAuth } from '@vibe-kit/auth/node';// Authenticate and get tokenlet accessToken = await ClaudeAuth.getValidToken();if (!accessToken) { await ClaudeAuth.authenticate(); accessToken = await ClaudeAuth.getValidToken();}// Use with Claude Code CLI// First, export the token as an environment variable:// export CLAUDE_CODE_OAUTH_TOKEN=${accessToken}// claude -p 'Hello, Claude!'
Node.js environments use MemoryTokenStorage by default, providing in-memory storage for server-side applications with secure file system token persistence.