---
title: "Authentication"
description: "Authentication methods for TraceRTM API"
keywords: [authentication, api keys, jwt, oauth, security]
---

# Authentication

TraceRTM supports multiple authentication methods for API access.

## Authentication Methods

### 1. API Keys

Simple authentication using API keys.

```python
from tracertm import TraceRTM

client = TraceRTM(api_key="rtm_live_abc123...")
```

[Learn more about API Keys →](/docs/api-reference/authentication/api-keys)

### 2. OAuth 2.0

OAuth 2.0 for third-party integrations.

```python
# OAuth flow
authorization_url = client.oauth.get_authorization_url()
# User authorizes...
token = client.oauth.get_token(code)
```

[Learn more about OAuth 2.0 →](/docs/api-reference/authentication/oauth2)

### 3. JWT Tokens

JSON Web Tokens for stateless authentication.

```python
# Get JWT token
token = client.auth.get_token(username, password)

# Use token
client = TraceRTM(token=token)
```

[Learn more about JWT →](/docs/api-reference/authentication/jwt)

## Quick Start

### Using API Key

```python
from tracertm import TraceRTM

# Initialize client
client = TraceRTM(api_key="rtm_live_abc123...")

# Make authenticated request
projects = client.projects.list()
```

### Using Environment Variable

```bash
# Set environment variable
export TRACERTM_API_KEY="rtm_live_abc123..."
```

```python
import os
from tracertm import TraceRTM

client = TraceRTM(api_key=os.getenv("TRACERTM_API_KEY"))
```

## Security Best Practices

1. **Never commit API keys** to version control
2. **Use environment variables** for API keys
3. **Rotate keys regularly**
4. **Use scopes** to limit permissions
5. **Monitor API usage** for suspicious activity

## Related Documentation

- [Authentication Overview](/docs/api-reference/authentication/overview) - Complete authentication guide
- [API Keys](/docs/api-reference/authentication/api-keys) - API key authentication
- [OAuth 2.0](/docs/api-reference/authentication/oauth2) - OAuth authentication
- [JWT Tokens](/docs/api-reference/authentication/jwt) - JWT authentication
- [Scopes](/docs/api-reference/authentication/scopes) - Permission scopes
- [Rate Limiting](/docs/api-reference/authentication/rate-limiting) - Rate limits
- [Best Practices](/docs/api-reference/authentication/best-practices) - Security best practices
