Skip to content

Conversation

@kishore7snehil
Copy link
Contributor

@kishore7snehil kishore7snehil commented Jan 22, 2026

This pull request merges the v5 branch into master, introducing version 5.0.0 of the Auth0 Python SDK. This marks a major, breaking rewrite of the SDK, fully generated from Auth0's OpenAPI specifications using Fern.

The Management API code is now auto-generated, featuring a new hierarchical package structure, improved type safety with Pydantic models, and updated usage patterns. The Authentication API remains manually maintained and is not affected by these changes. Additionally, documentation, workflows, and contribution guidelines have been updated to align with the new structure.


Major Breaking Changes and Improvements

SDK Rewrite and Breaking Changes

- Complete rewrite of the **Management SDK**, generated from OpenAPI specs using Fern, introducing:                                                  
- Hierarchical package structure with improved organization                                                                                        
- Strongly typed interfaces using Pydantic models                                                                                                  
- Automatic token management with client credentials                                                                                               
- Improved pagination with `SyncPager` and `AsyncPager`                                                                                            
- Enhanced error handling with structured exceptions                                                                                               
  • All Management API usage patterns have changed, including client initialization and method signatures. Refer to the v5 Migration Guide for detailed upgrade steps.

  • Package structure has changed from dictionary-based responses to Pydantic models. All imports and response handling must be updated.

  • Only the Authentication API is manually maintained. Contribution and code generation instructions have been updated accordingly.

Documentation and Examples

  • README.md and badges updated for v5
  • Installation instructions revised; new usage examples provided for both Authentication and Management APIs
  • Clarified Python version requirement: Python 3.8+ (Python 3.7 support dropped)
  • Contribution guidelines updated to reflect the new code generation process and testing instructions

Build, Linting, and Workflows

  • CI workflows updated to use the master branch (will be finalized in this PR)
  • v5-specific workflow files (v5-ci.yml, v5-publish.yml) to be removed or consolidated
  • Linting configuration adjusted for the new structure
  • Poetry and dependency management updated

Changelog

  • Added detailed changelog entries describing the rewrite, breaking changes, migration steps, and beta release notice

Please review the v5 Migration Guide and updated documentation to transition your codebase to the new SDK structure.


Note: The v4 branch has been preserved at the pre-v5 state for reference and potential maintenance releases.

# Auth0 Python SDK v5.0.0b0

⚠️ **BREAKING CHANGES - Major Rewrite**

This is a beta release of the upcoming major version. It introduces
breaking changes, particularly in the Management API client. Please
refer to the [v5 Migration
Guide](https://github.com/auth0/auth0-python/blob/v5/v5_MIGRATION_GUIDE.md)
for detailed upgrade instructions.

---

##  ✍️ What's New

- ✨ **OpenAPI-Generated**: Complete rewrite generated from Auth0's
OpenAPI specifications using [Fern](https://buildwithfern.com)
- 📦 **Better Organization**: Hierarchical package structure with logical
sub-clients for improved discoverability
- 🔒 **Type Safety**: Strongly typed request/response objects using
Pydantic replace generic dictionaries
- ✨ **Enhanced Developer Experience**: Better IntelliSense, code
completion, and documentation
- 🚀 **Future-Proof**: Easier maintenance and updates as Auth0's API
evolves
- ⚡ **Async Support**: First-class async client with `AsyncAuth0` and
`AsyncManagementClient`
- 📄 **Automatic Pagination**: Built-in pagination support with
`include_totals=True` by default

---

## 💥 Breaking Changes

### Python Version Support

- The SDK now requires **Python ≥3.8**
- Support for Python 3.7 has been dropped

### Management API Client Redesign

- The Management API client has been **fully restructured** using Fern
for code generation
- Methods are now organized into **modular sub-clients**, improving
structure and maintainability
- **Method names and signatures have changed**, adopting consistent and
predictable naming conventions
- **Pagination defaults changed**: `include_totals=True` is now the
default for list operations
- These changes are **not backward compatible** with the v4.x client

### Import Changes

| Change | v4.x | v5.0.0 |
|--------|------|--------|
| **Management Client** | `from auth0.management import Auth0` | `from
auth0.management import Auth0` or `ManagementClient` |
| **Async Client** | Not available | `from auth0.management import
AsyncAuth0` or `AsyncManagementClient` |
| **Error Handling** | `from auth0.exceptions import Auth0Error` | `from
auth0.management.core.api_error import ApiError` |
| **Authentication** | `from auth0.authentication import GetToken` |
`from auth0.authentication import GetToken` (unchanged) |

---

## 📝 Quick Migration Example

### Before (v4.x):

```python
from auth0.management import Auth0

# Initialize with full base URL
mgmt_api = Auth0(
    domain='YOUR_DOMAIN.auth0.com',
    token='YOUR_TOKEN'
)

# List users with explicit pagination
users = mgmt_api.users.list(
    page=0,
    per_page=50,
    include_totals=True  # Must specify explicitly
)

# Generic dictionary responses
for user in users['users']:
    print(user['email'])
```

### After (v5.0.0):

```python
from auth0.management import ManagementClient

# Simpler initialization - just domain
client = ManagementClient(
    domain='YOUR_DOMAIN.auth0.com',
    token='YOUR_TOKEN'
)

# Or with automatic token management
client = ManagementClient(
    domain='YOUR_DOMAIN.auth0.com',
    client_id='YOUR_CLIENT_ID',
    client_secret='YOUR_CLIENT_SECRET'
)

# Pagination with include_totals=True by default
response = client.users.list(
    page=0,
    per_page=50
)

# Strongly-typed Pydantic models
for user in response.users:
    print(user.email)  # Type-safe attribute access
```

---

## 🔧 Migration Steps

1. **Update imports**: Change import paths as shown in the table above
2. **Client initialization**: Use `ManagementClient` with just `domain`
instead of full `base_url`
3. **Update method calls**: Review method signatures - many have changed
for consistency
4. **Handle responses**: Access response data as attributes (Pydantic
models) instead of dictionary keys
5. **Error handling**: Catch `ApiError` instead of `Auth0Error` for
Management API errors
6. **Pagination**: `include_totals` now defaults to `True` - adjust if
you relied on `False`
7. **Async support**: Use `AsyncManagementClient` or `AsyncAuth0` for
async operations

---

## ✅ What's NOT Affected

**The `authentication` package remains fully compatible!** All
authentication APIs work the same way between v4.x and v5.0.0:

- ✅ `GetToken` - Client credentials, authorization code flows
- ✅ `Database` - User signup and authentication
- ✅ `Passwordless` - Passwordless authentication
- ✅ `Users` - User authentication operations
- ✅ Token verification and validation

---

## 📚 Resources

- **[Migration
Guide](https://github.com/auth0/auth0-python/blob/v5/v5_MIGRATION_GUIDE.md)**:
Detailed migration instructions
- **[API
Reference](https://github.com/auth0/auth0-python/blob/v5/reference.md)**:
Complete API documentation
- **[README](https://github.com/auth0/auth0-python/blob/v5/README.md)**:
Updated examples and usage guide

---

## ⚠️ Beta Release

This is a beta release. While core functionality is stable, minor API
adjustments may occur before the final v5.0.0 release. Please test
thoroughly and provide feedback!

---

## 📦 Installation

```bash
pip install auth0-python==5.0.0b0
```

Or add to your
[requirements.txt](cci:7://file:///Users/snehil.kishore/Desktop/Python/auth0-python/requirements.txt:0:0-0:0):
```
auth0-python>=5.0.0b0,<6.0.0
```

---
@kishore7snehil kishore7snehil requested a review from a team as a code owner January 22, 2026 19:16
Signed-off-by: Snehil Kishore <snehil.kishore@okta.com>
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Remove v5-ci.yml and v5-publish.yml as these are no longer needed
once v5 is merged to master. The main test.yml and publish.yml
workflows will handle CI/CD for the master branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants