v6.0.0
This is the first stable release of the v6 line. It introduces breaking changes to the Management API. Please consult the v6 Migration Guide for detailed upgrade instructions.
π What's New
This release marks a major milestone for the Auth0 Ruby SDK. The Management API client has been completely rewritten using the Fern code generation tool, built directly from the Auth0 OpenAPI specification. This delivers complete, always-up-to-date API coverage with full type safety. The Authentication API is ported from v5 and maintains full feature parity.
β¨ Highlights
- ποΈ Auto-generated Management API - Rebuilt from the Auth0 OpenAPI spec using Fern, ensuring complete endpoint coverage and consistency with the API
- π Strongly-typed responses - No more raw hashes. Every response is a typed object with attribute readers
- π Built-in pagination - List methods return iterators that automatically fetch pages as you iterate with
each - π Automatic token management - The unified
Auth0::Clienthandles the OAuth 2.0 client credentials grant, token caching, and a newtoken_provideroption for supplying tokens from an external source - β‘ Built-in retry - Automatic retries with exponential backoff for transient failures (408, 429, 5xx)
- π‘οΈ Exception-driven error handling - Non-2xx responses raise typed exceptions (
Auth0::Errors::NotFoundError, etc.) instead of returning error hashes - π¦ Leaner gem - The published gem now ships only runtime files (
bin/,test/,spec/,features/are excluded), reducing package size and scanner false positives
π What's Changed
The Management API has breaking changes:
| Area | v5 | v6 |
|---|---|---|
| Client | Auth0Client.new(...) |
Auth0::Client.new(...) (alias Auth0Client retained) |
| Sub-client access | client.users(per_page: 10) |
client.users.list(per_page: 10) |
| Get one | client.user('auth0|123') |
client.users.get(id: 'auth0|123') |
| Sub-resources | client.get_user_roles(user_id) |
client.users.roles.list(id:) |
| Params | Positional args + option hashes | Keyword arguments |
| Responses | Raw hashes | Typed objects (user.email) |
| Pagination | Arrays | `client.users.list.each { |
| Error handling | Error hashes | rescue Auth0::Errors::NotFoundError |
| API version | api_version: 2 |
Removed (v2 only) |
| HTTP layer | rest-client |
net/http (built-in) |
| Minimum Ruby | >= 2.5 |
>= 3.3 |
The Authentication API is unchanged - code written against it in v5 works in v6 with no changes.
π¦ Installation
gem install auth0π§ Quick Start
require 'auth0'
client = Auth0::Client.new(
client_id: ENV['AUTH0_CLIENT_ID'],
client_secret: ENV['AUTH0_CLIENT_SECRET'],
domain: ENV['AUTH0_DOMAIN']
)
# List users with automatic pagination
client.users.list(per_page: 50).each do |user|
puts user.email
end
# Create a role
role = client.roles.create(name: 'admin', description: 'Administrator role')