Skip to content

Commit ba3adfb

Browse files
Add logging support and SDK regeneration — April 22, 2026 (#858)
Co-authored-by: fern-api[bot] <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: tanya732 <sinha.tanya26@gmail.com>
1 parent 9593e46 commit ba3adfb

128 files changed

Lines changed: 1293 additions & 1953 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

EXAMPLES.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Management API usage](#management-api-usage)
66
- [Verifying an ID token](#verifying-an-id-token)
77
- [Organizations](#organizations)
8+
- [Logging](#logging)
89
- [Asynchronous operations](#asynchronous-operations)
910

1011
## Error handling
@@ -303,6 +304,71 @@ String url = auth.authorizeUrl("https://me.auth0.com/callback")
303304
.build();
304305
```
305306

307+
## Logging
308+
309+
The SDK is silent by default. You can enable logging to see HTTP requests and responses, which is useful for debugging.
310+
311+
### Enable logging with default settings
312+
313+
```java
314+
import com.auth0.client.mgmt.ManagementApi;
315+
import com.auth0.client.mgmt.core.LogConfig;
316+
317+
ManagementApi client = ManagementApi.builder()
318+
.domain("{YOUR_DOMAIN}")
319+
.token("{YOUR_API_TOKEN}")
320+
.logging(LogConfig.builder()
321+
.silent(false)
322+
.build())
323+
.build();
324+
```
325+
326+
### Enable debug-level logging
327+
328+
```java
329+
import com.auth0.client.mgmt.core.LogConfig;
330+
import com.auth0.client.mgmt.core.LogLevel;
331+
332+
ManagementApi client = ManagementApi.builder()
333+
.domain("{YOUR_DOMAIN}")
334+
.token("{YOUR_API_TOKEN}")
335+
.logging(LogConfig.builder()
336+
.level(LogLevel.DEBUG)
337+
.silent(false)
338+
.build())
339+
.build();
340+
```
341+
342+
### Using a custom logger
343+
344+
```java
345+
import com.auth0.client.mgmt.core.ILogger;
346+
import com.auth0.client.mgmt.core.LogConfig;
347+
import com.auth0.client.mgmt.core.LogLevel;
348+
349+
ManagementApi client = ManagementApi.builder()
350+
.domain("{YOUR_DOMAIN}")
351+
.token("{YOUR_API_TOKEN}")
352+
.logging(LogConfig.builder()
353+
.level(LogLevel.DEBUG)
354+
.logger(new MyCustomLogger()) // implements ILogger
355+
.silent(false)
356+
.build())
357+
.build();
358+
```
359+
360+
Logging is also available on the async client:
361+
362+
```java
363+
AsyncManagementApi asyncClient = AsyncManagementApi.builder()
364+
.token("{YOUR_API_TOKEN}")
365+
.tenantDomain("{YOUR_DOMAIN}")
366+
.logging(LogConfig.builder()
367+
.silent(false)
368+
.build())
369+
.build();
370+
```
371+
306372
## Asynchronous operations
307373

308374
### Management API

reference.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12569,7 +12569,7 @@ client.userAttributeProfiles().list(
1256912569
<dl>
1257012570
<dd>
1257112571

12572-
Retrieve details about a single User Attribute Profile specified by ID.
12572+
Create a User Attribute Profile
1257312573
</dd>
1257412574
</dl>
1257512575
</dd>
@@ -17514,9 +17514,12 @@ client.branding().phone().templates().update(
1751417514
<dd>
1751517515

1751617516
```java
17517-
client.branding().phone().templates().reset("id", new
17518-
HashMap<String, Object>() {{put("key", "value");
17519-
}});
17517+
client.branding().phone().templates().reset(
17518+
"id",
17519+
ResetPhoneTemplateRequestContent.of(new
17520+
HashMap<String, Object>() {{put("key", "value");
17521+
}})
17522+
);
1752017523
```
1752117524
</dd>
1752217525
</dl>
@@ -31029,7 +31032,7 @@ client.users().sessions().delete("user_id");
3102931032
<dl>
3103031033
<dd>
3103131034

31032-
List a verifiable credential templates.
31035+
List verifiable credential templates.
3103331036
</dd>
3103431037
</dl>
3103531038
</dd>
@@ -31420,3 +31423,4 @@ client.verifiableCredentials().verification().templates().update(
3142031423
</dd>
3142131424
</dl>
3142231425
</details>
31426+

src/main/java/com/auth0/client/mgmt/AsyncManagementApiBuilder.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import com.auth0.client.mgmt.core.ClientOptions;
77
import com.auth0.client.mgmt.core.Environment;
8+
import com.auth0.client.mgmt.core.LogConfig;
89
import java.util.HashMap;
910
import java.util.Map;
1011
import java.util.Optional;
@@ -23,6 +24,8 @@ public class AsyncManagementApiBuilder {
2324

2425
private OkHttpClient httpClient;
2526

27+
private Optional<LogConfig> logging = Optional.empty();
28+
2629
private String tenantDomain;
2730

2831
/**
@@ -67,6 +70,14 @@ public AsyncManagementApiBuilder httpClient(OkHttpClient httpClient) {
6770
return this;
6871
}
6972

73+
/**
74+
* Configure logging for the SDK. Silent by default — no log output unless explicitly configured.
75+
*/
76+
public AsyncManagementApiBuilder logging(LogConfig logging) {
77+
this.logging = Optional.of(logging);
78+
return this;
79+
}
80+
7081
/**
7182
* Add a custom header to be sent with all requests.
7283
* For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead.
@@ -92,6 +103,7 @@ protected ClientOptions buildClientOptions() {
92103
setHttpClient(builder);
93104
setTimeouts(builder);
94105
setRetries(builder);
106+
setLogging(builder);
95107
for (Map.Entry<String, String> header : this.customHeaders.entrySet()) {
96108
builder.addHeader(header.getKey(), header.getValue());
97109
}
@@ -171,6 +183,18 @@ protected void setHttpClient(ClientOptions.Builder builder) {
171183
}
172184
}
173185

186+
/**
187+
* Sets the logging configuration for the SDK.
188+
* Override this method to customize logging behavior.
189+
*
190+
* @param builder The ClientOptions.Builder to configure
191+
*/
192+
protected void setLogging(ClientOptions.Builder builder) {
193+
if (this.logging.isPresent()) {
194+
builder.logging(this.logging.get());
195+
}
196+
}
197+
174198
/**
175199
* Override this method to add any additional configuration to the client.
176200
* This method is called at the end of the configuration chain, allowing you to add

src/main/java/com/auth0/client/mgmt/AsyncRawRefreshTokensClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
222222
}
223223
try {
224224
switch (response.code()) {
225+
case 400:
226+
future.completeExceptionally(new BadRequestError(
227+
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
228+
response));
229+
return;
225230
case 401:
226231
future.completeExceptionally(new UnauthorizedError(
227232
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),

src/main/java/com/auth0/client/mgmt/AsyncRawUserAttributeProfilesClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
181181
}
182182

183183
/**
184-
* Retrieve details about a single User Attribute Profile specified by ID.
184+
* Create a User Attribute Profile
185185
*/
186186
public CompletableFuture<ManagementApiHttpResponse<CreateUserAttributeProfileResponseContent>> create(
187187
CreateUserAttributeProfileRequestContent request) {
188188
return create(request, null);
189189
}
190190

191191
/**
192-
* Retrieve details about a single User Attribute Profile specified by ID.
192+
* Create a User Attribute Profile
193193
*/
194194
public CompletableFuture<ManagementApiHttpResponse<CreateUserAttributeProfileResponseContent>> create(
195195
CreateUserAttributeProfileRequestContent request, RequestOptions requestOptions) {

src/main/java/com/auth0/client/mgmt/AsyncUserAttributeProfilesClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ public CompletableFuture<SyncPagingIterable<UserAttributeProfile>> list(
6565
}
6666

6767
/**
68-
* Retrieve details about a single User Attribute Profile specified by ID.
68+
* Create a User Attribute Profile
6969
*/
7070
public CompletableFuture<CreateUserAttributeProfileResponseContent> create(
7171
CreateUserAttributeProfileRequestContent request) {
7272
return this.rawClient.create(request).thenApply(response -> response.body());
7373
}
7474

7575
/**
76-
* Retrieve details about a single User Attribute Profile specified by ID.
76+
* Create a User Attribute Profile
7777
*/
7878
public CompletableFuture<CreateUserAttributeProfileResponseContent> create(
7979
CreateUserAttributeProfileRequestContent request, RequestOptions requestOptions) {

src/main/java/com/auth0/client/mgmt/ManagementApiBuilder.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
*/
44
package com.auth0.client.mgmt;
55

6-
import com.auth0.client.mgmt.core.ClientOptions;
7-
import com.auth0.client.mgmt.core.CustomDomainInterceptor;
8-
import com.auth0.client.mgmt.core.Environment;
9-
import com.auth0.client.mgmt.core.OAuthTokenSupplier;
6+
import com.auth0.client.mgmt.core.*;
107
import java.util.HashMap;
118
import java.util.Map;
129
import java.util.Optional;
@@ -26,6 +23,8 @@ public class ManagementApiBuilder {
2623

2724
private OkHttpClient httpClient;
2825

26+
private Optional<LogConfig> logging = Optional.empty();
27+
2928
private String customDomain = null;
3029

3130
// Domain-based initialization fields
@@ -168,6 +167,14 @@ public ManagementApiBuilder httpClient(OkHttpClient httpClient) {
168167
return this;
169168
}
170169

170+
/**
171+
* Configure logging for the SDK. Silent by default — no log output unless explicitly configured.
172+
*/
173+
public ManagementApiBuilder logging(LogConfig logging) {
174+
this.logging = Optional.of(logging);
175+
return this;
176+
}
177+
171178
/**
172179
* Add a custom header to be sent with all requests.
173180
* For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead.
@@ -188,6 +195,7 @@ protected ClientOptions buildClientOptions() {
188195
setHttpClient(builder);
189196
setTimeouts(builder);
190197
setRetries(builder);
198+
setLogging(builder);
191199
for (Map.Entry<String, String> header : this.customHeaders.entrySet()) {
192200
builder.addHeader(header.getKey(), header.getValue());
193201
}
@@ -293,6 +301,18 @@ protected void setHttpClient(ClientOptions.Builder builder) {
293301
}
294302
}
295303

304+
/**
305+
* Sets the logging configuration for the SDK.
306+
* Override this method to customize logging behavior.
307+
*
308+
* @param builder The ClientOptions.Builder to configure
309+
*/
310+
protected void setLogging(ClientOptions.Builder builder) {
311+
if (this.logging.isPresent()) {
312+
builder.logging(this.logging.get());
313+
}
314+
}
315+
296316
/**
297317
* Override this method to add any additional configuration to the client.
298318
* This method is called at the end of the configuration chain, allowing you to add

src/main/java/com/auth0/client/mgmt/RawRefreshTokensClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ public ManagementApiHttpResponse<GetRefreshTokenResponseContent> get(String id,
181181
}
182182
try {
183183
switch (response.code()) {
184+
case 400:
185+
throw new BadRequestError(
186+
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
184187
case 401:
185188
throw new UnauthorizedError(
186189
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);

src/main/java/com/auth0/client/mgmt/RawUserAttributeProfilesClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ public ManagementApiHttpResponse<SyncPagingIterable<UserAttributeProfile>> list(
146146
}
147147

148148
/**
149-
* Retrieve details about a single User Attribute Profile specified by ID.
149+
* Create a User Attribute Profile
150150
*/
151151
public ManagementApiHttpResponse<CreateUserAttributeProfileResponseContent> create(
152152
CreateUserAttributeProfileRequestContent request) {
153153
return create(request, null);
154154
}
155155

156156
/**
157-
* Retrieve details about a single User Attribute Profile specified by ID.
157+
* Create a User Attribute Profile
158158
*/
159159
public ManagementApiHttpResponse<CreateUserAttributeProfileResponseContent> create(
160160
CreateUserAttributeProfileRequestContent request, RequestOptions requestOptions) {

src/main/java/com/auth0/client/mgmt/UserAttributeProfilesClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ public SyncPagingIterable<UserAttributeProfile> list(
6363
}
6464

6565
/**
66-
* Retrieve details about a single User Attribute Profile specified by ID.
66+
* Create a User Attribute Profile
6767
*/
6868
public CreateUserAttributeProfileResponseContent create(CreateUserAttributeProfileRequestContent request) {
6969
return this.rawClient.create(request).body();
7070
}
7171

7272
/**
73-
* Retrieve details about a single User Attribute Profile specified by ID.
73+
* Create a User Attribute Profile
7474
*/
7575
public CreateUserAttributeProfileResponseContent create(
7676
CreateUserAttributeProfileRequestContent request, RequestOptions requestOptions) {

0 commit comments

Comments
 (0)