auth - Authentication

Establish secure connection with PrestaShop services.

Purpose

The auth command handles authentication with Prestashop Corp and PrestaShop Enterprise Platform, managing secure token-based authentication and OTP (One-Time Password) verification.

When to Use

  • First time setup: Initial authentication with Enterprise Platform
  • Authentication expires: When your stored tokens become invalid
  • Token refresh: When you need to refresh expired authentication tokens

Usage

Basic Authentication

# Default interactive authentication
ps-enterprise auth

Authentication with Email

# Specify email to avoid manual input
ps-enterprise auth --user john.doe@prestashop.com

Force Re-authentication

# Force re-authentication even if tokens exist
ps-enterprise auth --force

Options

Flag Short Description Required
--user -u Specify user email for authentication No
--force -f Force re-authentication No
--help -h Show command help No

Process

When you run the auth command, the following steps occur:

1. Check current authentication

  • If already authenticated, ask if you want to re-authenticate

2. Prestashop Authentication (browser)

  • Opens your default web browser
  • Redirects to PrestaShop login page
  • Uses prestashop.com accounts

3. Enterprise Authentication (CLI)

4. Enterprise OTP Verification (Optional)

  • Prompts for One-Time Password from your authenticator app
  • Note: App-based OTP only (Email OTP is not supported)
  • Validates OTP against Enterprise Platform

5. Connection Validation

  • Tests connection to Enterprise Platform
  • Validates access to required services
  • Confirms successful authentication

Success Indicators

After successful authentication to Prestashop, you’ll see in terminal:

✅ Thanks <username>, you are now authenticated with Prestashop Enterprise API

After successful authentication to Enterprise Platform, you’ll see in terminal:

✅ All set !

Troubleshooting

Authentication Failed

❌ Invalid credentials.

Solution: Verify your Enterprise Platform password.

OTP Verification Failed

❌ Authentication error: Invalid code.

Solution:

  • Ensure your authenticator app time is synchronized
  • Generate a new OTP and try again
  • Verify you’re using the correct authenticator account

Integration with Other Commands

The auth command integrates seamlessly with other CLI commands:

  • Automatic Check: Other commands automatically verify authentication
  • Auto-prompt: Commands prompt for authentication if tokens are missing
  • Shared Tokens: All commands share the same authentication tokens
  • Graceful Degradation: Commands fail gracefully with helpful messages if authentication is invalid
  • config - Configure environment after authentication
  • All other commands require valid authentication to function

Pro Tip: You can include the --user flag with any command that requires authentication to avoid manual email input during the auth process.
Security: Never share your authentication tokens or OTP codes. Each developer should use their own Enterprise Platform account.