The login command authenticates you with Codegen’s services, enabling access to AI features and private codemods.

Usage

codegen login [--token <token>]

Options

  • --token <token>: Directly provide an authentication token instead of using browser-based authentication

Authentication Flow

  1. Browser Authentication (Default):

    codegen login
    

    This will:

    • Open your default browser
    • Direct you to the Codegen authentication page
    • Automatically complete authentication when you log in
  2. Token Authentication:

    codegen login --token your-token-here
    

    Useful for:

    • CI/CD environments
    • Machines without browsers
    • Automated scripts

Validation

After logging in, Codegen will:

  1. Validate your credentials
  2. Store the authentication token securely
  3. Configure your environment for subsequent commands

Environment Variables

  • CODEGEN_TOKEN: Alternative way to provide authentication token
  • ENV: Set to prod or staging to specify environment

Examples

# Standard login with browser
codegen login

# Login with specific token
codegen login --token abc123

# Login to production
ENV=prod codegen login

Common Issues

  1. Browser doesn’t open:

    • Use the --token option instead
    • Check your default browser settings
  2. Token expired:

    • Simply run codegen login again
    • New token will replace the old one
  3. Permission issues:

    • Ensure you have the correct permissions
    • Contact support if problems persist

Your authentication token is stored securely in your system’s credential storage.

Never share your authentication token or commit it to version control.

Was this page helpful?