Authentication
Lingo.dev CLI communicates with Lingo.dev engine hosted in the cloud, so authentication is required to use the service.
Checking Authentication Status
To see if you're currently authenticated:
npx lingo.dev@latest auth
This command shows your current auth status and associated email if you're logged in.
Logging In
There are two ways to authenticate with Lingo.dev:
1. Interactive Browser Login
npx lingo.dev@latest auth --login
This opens your default browser for login. After logging in, you'll be redirected back to your terminal.
INFO
Some browser settings or ad blockers can block this redirect. If you encounter issues, try the environment variable method below.
2. Environment Variable
Set the LINGODOTDEV_API_KEY
environment variable with your API key:
export LINGODOTDEV_API_KEY=your_api_key_here
You can also use a .env
file in your project root:
LINGODOTDEV_API_KEY=your_api_key_here
WARNING
Never commit your .env
file to version control.
Logging Out
To log out and remove local authentication:
npx lingo.dev@latest auth --logout
This command removes your local authentication token, requiring you to log in again.
Keep in mind there's no need to log out if you're using environment variables.
Why Two Authentication Methods?
Lingo.dev offers both interactive and environment variable authentication for a reason:
- Interactive login is user-friendly and doesn't require managing API keys;
- Environment variables work well in CI/CD pipelines and servers.
The flexibility allows you to choose the method that best fits your workflow and security preferences.
Best Practices
- Never commit your API key to version control;
- If using the API key in a
.env
file, ensure it's in your.gitignore
and is never committed; - Rotate your API key periodically for enhanced security;
- Use environment variables in CI/CD pipelines to avoid interactive prompts.
By understanding these authentication methods, you can securely integrate Lingo.dev into your development process, whether you're working locally or in an automated environment.