You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: EXAMPLES.md
+77-7Lines changed: 77 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2965,7 +2965,11 @@ Check the [API documentation](https://auth0.github.io/Auth0.swift/documentation/
2965
2965
2966
2966
## Logging
2967
2967
2968
-
Auth0.swift can print HTTP requests and responses for debugging purposes. Enable it by calling the following method in either `WebAuth`, `Authentication` or `Users`:
2968
+
Auth0.swift provides comprehensive logging capabilities for debugging HTTP requests and responses. The logging system is built on Apple's [Unified Logging](https://developer.apple.com/documentation/os/logging) (`OSLog`) for better performance and integration with system diagnostic tools.
2969
+
2970
+
### Enable Logging
2971
+
2972
+
Enable logging by calling the `logging(enabled:)` method on `WebAuth`, `Authentication`, or `Users`:
2969
2973
2970
2974
```swift
2971
2975
Auth0
@@ -2974,32 +2978,98 @@ Auth0
2974
2978
// ...
2975
2979
```
2976
2980
2981
+
```swift
2982
+
Auth0
2983
+
.authentication()
2984
+
.logging(enabled: true)
2985
+
// ...
2986
+
```
2987
+
2988
+
```swift
2989
+
Auth0
2990
+
.users(token: credentials.accessToken)
2991
+
.logging(enabled: true)
2992
+
// ...
2993
+
```
2994
+
2977
2995
> [!CAUTION]
2978
-
> Set this flag only when **DEBUGGING** to avoid leaking user's credentials in the device log.
2996
+
> Enable logging **only when debugging** to avoid performance impacts and potential security concerns in production builds.
2997
+
2998
+
### Automatic Token Redaction
2979
2999
2980
-
With a successful authentication you should see something similar to the following:
3000
+
**Security First**: Auth0.swift automatically redacts sensitive information from logs to protect user credentials. The following fields are redacted when logging HTTP responses:
3001
+
3002
+
-`access_token`
3003
+
-`refresh_token`
3004
+
-`id_token`
3005
+
3006
+
Redacted tokens appear as `"redacted"` in the logs, ensuring sensitive data never appears in plain text.
3007
+
3008
+
### Logging Output
3009
+
3010
+
With logging enabled, you'll see detailed HTTP request and response information. Here's an example of what a successful authentication flow looks like:
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -347,7 +347,7 @@ Check the [FAQ](FAQ.md) for more information about the alert box that pops up **
347
347
348
348
Auth0.swift uses Apple's Unified Logging (OSLog) to help you troubleshoot issues during development. Enable detailed HTTP logging to see network requests, responses, and errors.
349
349
350
-
### Enable Logging (NetworK Tracing based logs)
350
+
### Enable Logging (Network Tracing based logs)
351
351
352
352
To enable detailed HTTP request and response tracing during development:
0 commit comments