docs: update login command documentation to include silent flag usage and improve accordion structure

This commit is contained in:
Victor Santos
2025-10-22 23:40:27 -03:00
parent 4116dde66f
commit 9bf8e2a4f4
+54 -44
View File
@@ -22,10 +22,12 @@ If you have added multiple users, you can switch between the users by using the
<Info> <Info>
**JWT Token Output:** **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 - 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.
</Info> </Info>
### Authentication Methods ### Authentication Methods
@@ -61,34 +63,33 @@ User authentication is designed for individual developers and supports multiple
</Expandable> </Expandable>
</ParamField> </ParamField>
<Steps> <AccordionGroup>
<Step title="Choose your login method"> <Accordion title="Browser Login (Default)">
**Browser Login (Default)** ```bash
```bash infisical login
infisical login ```
``` </Accordion>
<Accordion title="Direct Login (CI/CD)">
**Direct Login (CI/CD)** ```bash
```bash infisical login [email protected] --password=your-password
infisical login [email protected] --password=your-password
# Or using environment variables
# Or using environment variables export INFISICAL_EMAIL="[email protected]"
export INFISICAL_EMAIL="[email protected]" export INFISICAL_PASSWORD="your-password"
export INFISICAL_PASSWORD="your-password" infisical login
infisical login ```
``` </Accordion>
<Accordion title="Interactive CLI Login">
**Interactive CLI Login** ```bash
```bash infisical login --interactive
infisical login --interactive ```
``` </Accordion>
<Accordion title="Plain Token Output (for scripting)">
**Plain Token Output (for scripting)** ```bash
```bash export INFISICAL_TOKEN=$(infisical login [email protected] --password=your-password --plain --silent)
export INFISICAL_TOKEN=$(infisical login [email protected] --password=your-password --plain) ```
``` </Accordion>
</Step> </AccordionGroup>
</Steps>
</Accordion> </Accordion>
</AccordionGroup> </AccordionGroup>
@@ -457,9 +458,13 @@ The login command supports a number of flags that you can use for different auth
```bash ```bash
# Example: Capture token in a variable # Example: Capture token in a variable
export INFISICAL_TOKEN=$(infisical login --email=<email> --password=<password> --plain) export INFISICAL_TOKEN=$(infisical login --email=<email> --password=<password> --plain --silent)
``` ```
<Tip>
Use it alongside the `silent` flag to disable all messages in the console except from the access token.
</Tip>
</Accordion> </Accordion>
<Accordion title="--oidc-jwt"> <Accordion title="--oidc-jwt">
```bash ```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. The following examples demonstrate different ways to authenticate as a user with the Infisical CLI.
<AccordionGroup> <AccordionGroup>
<Accordion title="Browser Login (Default)">
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.
</Accordion>
<Accordion title="Direct Login (Non-Interactive)"> <Accordion title="Direct Login (Non-Interactive)">
Direct login is ideal for CI/CD pipelines and automation scripts where browser-based authentication is not possible. 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 [email protected] --password "your-password" --domain https://eu.infisical.com infisical login --email [email protected] --password "your-password" --domain https://eu.infisical.com
# Output only JWT token for scripting # Output only JWT token for scripting
export INFISICAL_TOKEN=$(infisical login --email [email protected] --password "your-password" --plain) export INFISICAL_TOKEN=$(infisical login --email [email protected] --password "your-password" --plain --silent)
``` ```
#### Using Environment Variables (Recommended for CI/CD) #### 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 infisical login
# Or with plain output for token capture # Or with plain output for token capture
export INFISICAL_TOKEN=$(infisical login --plain) export INFISICAL_TOKEN=$(infisical login --plain --silent)
``` ```
</Accordion> </Accordion>
@@ -530,19 +547,12 @@ The following examples demonstrate different ways to authenticate as a user with
</Accordion> </Accordion>
<Accordion title="Browser Login (Default)">
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.
</Accordion>
</AccordionGroup> </AccordionGroup>
<Tip>
If you have SSO enabled, we recommend using the default browser login.
</Tip>
### Machine Identity Authentication Quick Start ### 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. 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.