diff --git a/EXAMPLES.md b/EXAMPLES.md index 8704ae4a..f584f7e2 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -11,6 +11,7 @@ Each topic lives in its own file under [`examples/`](examples). - [Ephemeral Browsing](examples/ephemeral-browsing.md) - [Auth Tab](examples/auth-tab.md) - [DPoP](examples/dpop.md) +- [Experiment Center](examples/experiment-center.md) - [Handling Configuration Changes During Authentication](examples/configuration-changes.md) ## Authentication API diff --git a/README.md b/README.md index 440b99c8..e6fc96e8 100644 --- a/README.md +++ b/README.md @@ -316,6 +316,25 @@ WebAuthProvider.login(account) .await(this) ``` +### Experiment Center + +> [!NOTE] +> Experiment Center support via SDKs is currently in Early Access. To request access to this feature, contact your Auth0 representative. + +[Experiment Center](https://auth0.com/docs/customize/experiment-center/overview) is Auth0's A/B testing platform for authentication flows. Pass `experiment_id`, `variation_id`, and optionally `segment_id` via `withParameters()` to force a specific variation on a Web Auth login request: + +```kotlin +WebAuthProvider.login(account) + .withParameters(mapOf( + "experiment_id" to "", + "variation_id" to "", + "segment_id" to "" // optional + )) + .start(this, callback) +``` + +See the [full usage example](examples/experiment-center.md) for coroutine and Java samples. + ## Credentials Manager This library ships with two additional classes that help you manage the Credentials received during authentication. diff --git a/examples/experiment-center.md b/examples/experiment-center.md new file mode 100644 index 00000000..2096ef9e --- /dev/null +++ b/examples/experiment-center.md @@ -0,0 +1,54 @@ +# Experiment Center + +[Experiment Center](https://auth0.com/docs/customize/experiment-center/overview) is Auth0's A/B testing platform for authentication flows. It lets you split traffic across variants, measure results, and promote the winner — all inside Auth0. + +Pass `experiment_id`, `variation_id`, and optionally `segment_id` via `withParameters()` to force a user into a specific variation for the login request, bypassing the server-side deterministic assignment. All three IDs are obtained from your Auth0 Dashboard or the Management API: + +- `experiment_id` — the ID of the experiment to target +- `variation_id` — the specific variation to assign to this user +- `segment_id` — _(optional)_ restricts the override to a particular audience segment within the experiment + +```kotlin +WebAuthProvider.login(account) + .withParameters(mapOf( + "experiment_id" to "", + "variation_id" to "", + "segment_id" to "" // optional + )) + .start(this, callback) +``` + +
+ Using coroutines + +```kotlin +WebAuthProvider.login(account) + .withParameters(mapOf( + "experiment_id" to "", + "variation_id" to "", + "segment_id" to "" // optional + )) + .await(this) +``` + +
+ +
+ Using Java + +```java +WebAuthProvider.login(account) + .withParameters(new HashMap() {{ + put("experiment_id", ""); + put("variation_id", ""); + put("segment_id", ""); // optional + }}) + .start(this, callback); +``` + +
+ +> [!NOTE] +> Experiment Center is an Enterprise feature, and support via SDKs is currently in Early Access. To request access to this feature, contact your Auth0 representative. The override only applies to the current request — the next login without these parameters reverts to server-side deterministic assignment. Refer to the [Experiment Center documentation](https://auth0.com/docs/customize/experiment-center/overview) for setup instructions. +> +> Only `WebAuthProvider` login reaches Experiment Center. Embedded/native login and ROPG skip `/authorize` entirely and do not support experiment overrides.