diff --git a/docs/cli/commands/login.mdx b/docs/cli/commands/login.mdx index a995cc3822..9cfdc9645e 100644 --- a/docs/cli/commands/login.mdx +++ b/docs/cli/commands/login.mdx @@ -22,10 +22,12 @@ If you have added multiple users, you can switch between the users by using the **JWT Token Output:** - - For **user authentication** with the `--plain` flag: outputs only the JWT access token (useful for scripting) + - For **user authentication** with the `--plain --silent` flags: outputs only the JWT access token (useful for scripting) - For **machine identity authentication**: an access token is always printed to the console - Use the `--plain` flag to print only the token in plain text, which is ideal for capturing in environment variables or CI/CD pipelines. + Use the `--plain` flag to print only the token in plain text and the `--silent` flag to disable update alerts. + + Both flags are ideal for capturing the token in environment variables or CI/CD pipelines. ### Authentication Methods @@ -61,34 +63,33 @@ User authentication is designed for individual developers and supports multiple - - - **Browser Login (Default)** - ```bash - infisical login - ``` - - **Direct Login (CI/CD)** - ```bash - infisical login --email=user@example.com --password=your-password - - # Or using environment variables - export INFISICAL_EMAIL="user@example.com" - export INFISICAL_PASSWORD="your-password" - infisical login - ``` - - **Interactive CLI Login** - ```bash - infisical login --interactive - ``` - - **Plain Token Output (for scripting)** - ```bash - export INFISICAL_TOKEN=$(infisical login --email=user@example.com --password=your-password --plain) - ``` - - + + + ```bash + infisical login + ``` + + + ```bash + infisical login --email=user@example.com --password=your-password + + # Or using environment variables + export INFISICAL_EMAIL="user@example.com" + export INFISICAL_PASSWORD="your-password" + infisical login + ``` + + + ```bash + infisical login --interactive + ``` + + + ```bash + export INFISICAL_TOKEN=$(infisical login --email=user@example.com --password=your-password --plain --silent) + ``` + + @@ -457,9 +458,13 @@ The login command supports a number of flags that you can use for different auth ```bash # Example: Capture token in a variable - export INFISICAL_TOKEN=$(infisical login --email= --password= --plain) + export INFISICAL_TOKEN=$(infisical login --email= --password= --plain --silent) ``` + + Use it alongside the `silent` flag to disable all messages in the console except from the access token. + + ```bash @@ -481,6 +486,18 @@ The login command supports a number of flags that you can use for different auth The following examples demonstrate different ways to authenticate as a user with the Infisical CLI. + + By default, running `infisical login` without any flags opens your browser for authentication. + + ```bash + # Opens browser for authentication + infisical login + ``` + + The browser will open to the Infisical login page, and upon successful authentication, the CLI will be automatically authenticated. + + + Direct login is ideal for CI/CD pipelines and automation scripts where browser-based authentication is not possible. @@ -497,7 +514,7 @@ The following examples demonstrate different ways to authenticate as a user with infisical login --email user@example.com --password "your-password" --domain https://eu.infisical.com # Output only JWT token for scripting - export INFISICAL_TOKEN=$(infisical login --email user@example.com --password "your-password" --plain) + export INFISICAL_TOKEN=$(infisical login --email user@example.com --password "your-password" --plain --silent) ``` #### Using Environment Variables (Recommended for CI/CD) @@ -512,7 +529,7 @@ The following examples demonstrate different ways to authenticate as a user with infisical login # Or with plain output for token capture - export INFISICAL_TOKEN=$(infisical login --plain) + export INFISICAL_TOKEN=$(infisical login --plain --silent) ``` @@ -530,19 +547,12 @@ The following examples demonstrate different ways to authenticate as a user with - - By default, running `infisical login` without any flags opens your browser for authentication. - - ```bash - # Opens browser for authentication - infisical login - ``` - - The browser will open to the Infisical login page, and upon successful authentication, the CLI will be automatically authenticated. - - + +If you have SSO enabled, we recommend using the default browser login. + + ### Machine Identity Authentication Quick Start In this example we'll be using the `universal-auth` method to login to obtain an Infisical access token, which we will then use to fetch secrets with.