> ## Documentation Index
> Fetch the complete documentation index at: https://docs.controlplane.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Authentication methods for Console UI (SSO via Google, GitHub, Microsoft, SAML) and CLI (interactive login, service accounts, and token management).

Control Plane supports multiple authentication methods depending on how you access the platform.

***

## Console UI

The Console supports single sign-on (SSO) for user authentication with the following providers:

> [card] Google

> [card] GitHub

> [card] Microsoft

> [card] SAML

After successful authentication, users' access privileges are determined based on their assigned [group membership](https://docs.controlplane.com/reference/group.md) or [policy](https://docs.controlplane.com/reference/policy.md).

> [accordion] SAML Configuration
>
> To enable SAML authentication for your organization, contact us on Slack or at [support@controlplane.com](mailto:support@controlplane.com).
>
> **Values required from your authentication provider:**
>
> * Entity ID
> * SSO URL
> * Certificate
>
> **Control Plane SAML configuration values:**
>
> * Service Provider Entity ID: `cpln.io`
> * Assertion Consumer Service (ACS) / Callback URL: `https://console.cpln.io/__/auth/handler`

***

## CLI

The CLI supports two authentication methods:

> [tab] Interactive Login
>
> For interactive use, run the login command, which prints a URL and a confirmation code you use to complete SSO sign-in from any browser:
>
> ```bash theme={null}
> cpln login
> ```
>
> This creates a default profile for your credentials. The browser does not have to be on the same machine as the CLI.

> [tab] Service Account Token
>
> For CI/CD pipelines and automation, use a service account token:
>
> ```bash theme={null}
> # Create a profile using a service account token
> cpln profile create PROFILE_NAME --org ORG_NAME --token TOKEN --default
> ```
>
> The `--default` flag sets this profile as the default for future commands.
>
> You can also use the `CPLN_TOKEN` environment variable:
>
> ```bash theme={null}
> export CPLN_TOKEN=your-service-account-token
> ```

> [card] [CLI Authentication Guide](https://docs.controlplane.com/cli-reference/get-started/authentication.md)
>
> Complete guide for CLI authentication, including service account token setup for CI/CD.

***

## Terraform

Configure the provider with your organization and authentication credentials:

```hcl theme={null}
provider "cpln" {
  org   = "your-org-name"
  token = var.cpln_token  # Service account token
}
```

Or use environment variables:

```bash theme={null}
export CPLN_ORG=your-org-name
export CPLN_TOKEN=your-service-account-token
```

> [card] [Terraform Provider](https://docs.controlplane.com/iac/terraform.md)
>
> Complete Terraform provider setup and configuration

***

## Pulumi

Configure authentication using either Pulumi config or environment variables:

> [tab] Pulumi Config
>
> ```bash theme={null}
> pulumi config set cpln:org your-org-name
> pulumi config set --secret cpln:token your-service-account-token
> ```

> [tab] Environment Variables
>
> ```bash theme={null}
> export CPLN_ORG=your-org-name
> export CPLN_TOKEN=your-service-account-token
> ```

> [card] [Pulumi Provider](https://docs.controlplane.com/iac/pulumi.md)
>
> Complete Pulumi provider setup and configuration

***

## REST API

Authenticate API requests using a bearer token in the `Authorization` header:

```bash theme={null}
curl --request GET \
  --url https://api.cpln.io/org/your-org/gvc \
  --header 'Authorization: Bearer YOUR_TOKEN'
```

Tokens can be obtained from:

* **Service account key**: Generated when creating a service account
* **User access token**: Run `cpln profile token PROFILE_NAME`

> [card] [API Reference](https://docs.controlplane.com/api-reference/api.md)
>
> Complete API documentation with interactive examples

***

## Service Accounts

For programmatic access (CI/CD, automation, and IaC), create a [service account](https://docs.controlplane.com/reference/serviceaccount.md) and generate a key:

**1. Create a service account**

In the Console, navigate to **Service Accounts** and click **New**, or use the CLI:

```bash theme={null}
cpln serviceaccount create --name my-service-account --org my-org
```

**2. Generate a key**

```bash theme={null}
cpln serviceaccount add-key my-service-account --description my-key --org my-org
```

> [!WARNING]
>
> The key is shown only once. Save it immediately in a secure location.

**3. Grant permissions**

Add the service account to a [group](https://docs.controlplane.com/reference/group.md) or create a [policy](https://docs.controlplane.com/reference/policy.md) that grants the necessary permissions.

**4. Use the token**

Use the generated key as your token in the CLI, Terraform, Pulumi, or API requests.

> [card] [Create a Service Account](https://docs.controlplane.com/guides/create-service-account.md)
>
> Step-by-step guide for creating and configuring service accounts
