# Authentication management

> Authentication management - Manage authentication with DataRobot.

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-05-06T18:17:09.545330+00:00` (UTC).

## Primary page

- [Authentication management](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html): Full documentation for this topic (HTML).

## Sections on this page

- [Synopsis](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#synopsis): In-page section heading.
- [Description](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#description): In-page section heading.
- [Commands](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#commands): In-page section heading.
- [login](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#login): In-page section heading.
- [logout](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#logout): In-page section heading.
- [set-url](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#set-url): In-page section heading.
- [Global flags](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#global-flags): In-page section heading.
- [Examples](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#examples): In-page section heading.
- [Initial setup](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#initial-setup): In-page section heading.
- [Using cloud instance shortcuts](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#using-cloud-instance-shortcuts): In-page section heading.
- [Self-managed instance](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#self-managed-instance): In-page section heading.
- [Re-authentication](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#re-authentication): In-page section heading.
- [Switching instances](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#switching-instances): In-page section heading.
- [Debug authentication issues](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#debug-authentication-issues): In-page section heading.
- [Authentication flow](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#authentication-flow): In-page section heading.
- [Configuration file](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#configuration-file): In-page section heading.
- [Security best practices](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#security-best-practices): In-page section heading.
- [1. Protect your config file](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#protect-your-config-file): In-page section heading.
- [2. Do not share credentials](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#dont-share-credentials): In-page section heading.
- [3. Use per-environment authentication](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#use-per-environment-authentication): In-page section heading.
- [4. Regular re-authentication](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#regular-re-authentication): In-page section heading.
- [Environment variables](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#environment-variables): In-page section heading.
- [Common issues](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#common-issues): In-page section heading.
- [Browser doesn't open](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#browser-doesnt-open): In-page section heading.
- [Port already in use](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#port-already-in-use): In-page section heading.
- [Invalid credentials](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#invalid-credentials): In-page section heading.
- [Connection refused](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#connection-refused): In-page section heading.
- [SSL certificate issues](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#ssl-certificate-issues): In-page section heading.
- [See also](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/auth.html#see-also): In-page section heading.

## Related documentation

- [Agentic AI](https://docs.datarobot.com/en/docs/agentic-ai/index.html): Linked from this page.
- [CLI](https://docs.datarobot.com/en/docs/agentic-ai/cli/index.html): Linked from this page.
- [Command reference](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/index.html): Linked from this page.
- [Getting Started](https://docs.datarobot.com/en/docs/agentic-ai/cli/getting-started.html): Linked from this page.
- [Configuration](https://docs.datarobot.com/en/docs/agentic-ai/cli/configuration.html): Linked from this page.
- [templates](https://docs.datarobot.com/en/docs/agentic-ai/cli/template-system/index.html): Linked from this page.

## Documentation content

Manage authentication with DataRobot.

## Synopsis

```
dr auth <command> [flags]
```

## Description

The `auth` command provides authentication management for the DataRobot CLI. It handles login, logout, and URL configuration for connecting to your DataRobot instance.

## Commands

### login

Authenticate with DataRobot using OAuth.

```
dr auth login
```

Behavior: 1. Starts a local web server (typically on port 8080)
2. Opens your default browser to DataRobot's OAuth page
3. Prompts you to authorize the CLI
4. Receives and stores the API key
5. Closes the browser and server automatically

Example:

```
$ dr auth login
Opening browser for authentication...
Waiting for authentication...
✓ Successfully authenticated!
```

Stored Credentials: - Location: `~/.config/datarobot/drconfig.yaml` (Linux/macOS) or `%USERPROFILE%\.config\datarobot\drconfig.yaml` (Windows)
- Format: Encrypted API key

Troubleshooting:

```
# If browser doesn't open automatically
# The CLI will display a URL to visit manually:
$ dr auth login
Failed to open browser automatically.
Please visit: https://app.datarobot.com/oauth/authorize?client_id=...

# Port already in use
# The CLI will try alternative ports automatically
```

### logout

Remove stored authentication credentials.

```
dr auth logout
```

Example:

```
$ dr auth logout
✓ Successfully logged out
```

Effect: - Removes API key from config file
- Keeps DataRobot URL configuration
- Next API call will require re-authentication

### set-url

Configure the DataRobot instance URL.

```
dr auth set-url [url]
```

Arguments: - `url` (optional) - DataRobot instance URL

Interactive Mode:

If no URL is provided, enters interactive mode:

```
$ dr auth set-url
Please specify your DataRobot URL, or enter the numbers 1 - 3 if you are using that multi tenant cloud offering
Please enter 1 if you are using https://app.datarobot.com
Please enter 2 if you are using https://app.eu.datarobot.com
Please enter 3 if you are using https://app.jp.datarobot.com
Otherwise, please enter the URL you use

> _
```

Direct Mode:

Specify URL directly:

```
# Using cloud shortcuts
$ dr auth set-url 1          # Sets to https://app.datarobot.com
$ dr auth set-url 2          # Sets to https://app.eu.datarobot.com
$ dr auth set-url 3          # Sets to https://app.jp.datarobot.com

# Using full URL
$ dr auth set-url https://app.datarobot.com
$ dr auth set-url https://my-company.datarobot.com
```

Validation:

```
$ dr auth set-url invalid-url
Error: Invalid URL format
```

## Global flags

These flags work with all `auth` commands:

```
  -v, --verbose      Enable verbose output
      --debug        Enable debug output
      --skip-auth    Skip authentication checks (for advanced users)
  -h, --help         Show help for command
```

> ⚠️ Warning:The--skip-authflag bypasses all authentication checks. This is intended for advanced use cases where authentication is handled externally or not required. When this flag is used, commands that require authentication may fail with API errors.

## Examples

### Initial setup

```
# Set URL and login (recommended workflow)
$ dr auth set-url https://app.datarobot.com
✓ DataRobot URL set to: https://app.datarobot.com

$ dr auth login
Opening browser for authentication...
✓ Successfully authenticated!
```

### Using cloud instance shortcuts

```
# US Cloud
$ dr auth set-url 1
$ dr auth login

# EU Cloud
$ dr auth set-url 2
$ dr auth login

# Japan Cloud
$ dr auth set-url 3
$ dr auth login
```

### Self-managed instance

```
$ dr auth set-url https://datarobot.mycompany.com
$ dr auth login
```

### Re-authentication

```
# Logout and login again
$ dr auth logout
✓ Successfully logged out

$ dr auth login
Opening browser for authentication...
✓ Successfully authenticated!
```

### Switching instances

```
# Switch to different DataRobot instance
$ dr auth set-url https://staging.datarobot.com
$ dr auth login
```

### Debug authentication issues

```
# Use verbose flag for details
$ dr auth login --verbose
[INFO] Starting OAuth server on port 8080
[INFO] Opening browser to: https://app.datarobot.com/oauth/...
[INFO] Waiting for callback...
[INFO] Received authorization code
[INFO] Exchanging code for token...
[INFO] Token saved successfully
✓ Successfully authenticated!

# Use debug flag for even more details
$ dr auth login --debug
[DEBUG] Config file: /Users/username/.datarobot/config.yaml
[DEBUG] Current URL: https://app.datarobot.com
[DEBUG] Starting server on: 127.0.0.1:8080
...
```

## Authentication flow

```
┌──────────┐
│   User   │
└────┬─────┘
     │
     │ dr auth login
     │
     v
┌─────────────────┐       ┌──────────────┐
│  Local Server   │◄──────┤   Browser    │
│  (Port 8080)    │       │              │
└────┬────────────┘       └──────▲───────┘
     │                            │
     │                            │ Opens
     │                            │
     v                            │
┌─────────────────┐               │
│  DataRobot      │───────────────┘
│  OAuth Server   │
└────┬────────────┘
     │
     │ Returns API Key
     │
     v
┌─────────────────┐
│  Config File    │
│  (~/.config/    │
│   datarobot/    │
│   drconfig.yaml)│
└─────────────────┘
```

## Configuration file

After authentication, credentials are stored in:

Location: - Linux/macOS: `~/.config/datarobot/drconfig.yaml` - Windows: `%USERPROFILE%\.config\datarobot\drconfig.yaml`

Format:

```
datarobot:
  endpoint: https://app.datarobot.com
  token: <encrypted_key>

# User preferences
preferences:
  default_timeout: 30
  verify_ssl: true
```

Permissions: - File is created with restricted permissions (0600)
- Only the user who created it can read/write

## Security best practices

### 1. Protect your config file

```
# Verify permissions
ls -la ~/.config/datarobot/drconfig.yaml
# Should show: -rw------- (600)

# Fix if needed
chmod 600 ~/.config/datarobot/drconfig.yaml
```

### 2. Do not share credentials

Never commit or share:
- `~/.config/datarobot/drconfig.yaml` - API keys
- OAuth tokens

### 3. Use per-environment authentication

```
# Development
export DATAROBOT_CLI_CONFIG=~/.config/datarobot/dev-config.yaml
dr auth set-url https://dev.datarobot.com --config $DATAROBOT_CLI_CONFIG
dr auth login

# Production
export DATAROBOT_CLI_CONFIG=~/.config/datarobot/prod-config.yaml
dr auth set-url https://prod.datarobot.com --config $DATAROBOT_CLI_CONFIG
dr auth login
```

### 4. Regular re-authentication

```
# Logout when finished
dr auth logout

# Login only when needed
dr auth login
```

## Environment variables

Override configuration with environment variables:

```
# Override URL
export DATAROBOT_ENDPOINT=https://app.datarobot.com

# Override API key (not recommended)
export DATAROBOT_API_TOKEN=your-api-token

# Custom config file location
export DATAROBOT_CLI_CONFIG=~/.config/datarobot/custom-config.yaml
```

## Common issues

### Browser doesn't open

Problem: Browser fails to open automatically.

Solution:

```
# Copy the URL from the output and open manually
$ dr auth login
Failed to open browser automatically.
Please visit: https://app.datarobot.com/oauth/authorize?...
```

### Port already in use

Problem: Port 8080 is already in use.

Solution: The CLI automatically tries alternative ports (8081, 8082, etc.)

### Invalid credentials

Problem:"Authentication failed" error.

Solution:

```
# Clear credentials and try again
dr auth logout
dr auth login
```

### Connection refused

Problem: Cannot connect to DataRobot.

Solution:

```
# Verify URL is correct
cat ~/.config/datarobot/drconfig.yaml

# Try setting URL again
dr auth set-url https://app.datarobot.com

# Check network connectivity
ping app.datarobot.com
```

### SSL certificate issues

Problem: SSL verification fails.

Solution:

```
# For self-signed certificates (not recommended for production)
export DATAROBOT_VERIFY_SSL=false
dr auth login
```

## See also

- Getting Started - Initial setup guide
- Configuration - Configuration file details
- templates - Template management commands
