-
Notifications
You must be signed in to change notification settings - Fork 182
docs(examples): add Experiment Center override example #1066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,89 @@ | ||||||
| # Experiment Center | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is in beta. We should also add that note here |
||||||
|
|
||||||
| [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` and `variation_id` via `withParameters()` to force a user into a specific variation for the login request, bypassing the server-side deterministic assignment. Both IDs are obtained from your Auth0 Dashboard or the Management API. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we mention about segment id here |
||||||
|
|
||||||
| ```kotlin | ||||||
| WebAuthProvider.login(account) | ||||||
| .withParameters(mapOf( | ||||||
| "experiment_id" to "<EXPERIMENT_ID>", | ||||||
| "variation_id" to "<VARIATION_ID>" | ||||||
| )) | ||||||
| .start(this, callback) | ||||||
| ``` | ||||||
|
|
||||||
| <details> | ||||||
| <summary>Using coroutines</summary> | ||||||
|
|
||||||
| ```kotlin | ||||||
| WebAuthProvider.login(account) | ||||||
| .withParameters(mapOf( | ||||||
| "experiment_id" to "<EXPERIMENT_ID>", | ||||||
| "variation_id" to "<VARIATION_ID>" | ||||||
| )) | ||||||
| .await(this) | ||||||
| ``` | ||||||
|
|
||||||
| </details> | ||||||
|
|
||||||
| <details> | ||||||
| <summary>Using Java</summary> | ||||||
|
|
||||||
| ```java | ||||||
| WebAuthProvider.login(account) | ||||||
| .withParameters(new HashMap<String, Object>() {{ | ||||||
| put("experiment_id", "<EXPERIMENT_ID>"); | ||||||
| put("variation_id", "<VARIATION_ID>"); | ||||||
| }}) | ||||||
| .start(this, callback); | ||||||
| ``` | ||||||
|
|
||||||
| </details> | ||||||
|
|
||||||
| When the experiment uses segment targeting, also pass `segment_id`: | ||||||
|
|
||||||
| ```kotlin | ||||||
| WebAuthProvider.login(account) | ||||||
| .withParameters(mapOf( | ||||||
| "experiment_id" to "<EXPERIMENT_ID>", | ||||||
| "variation_id" to "<VARIATION_ID>", | ||||||
| "segment_id" to "<SEGMENT_ID>" | ||||||
| )) | ||||||
| .start(this, callback) | ||||||
| ``` | ||||||
|
|
||||||
| <details> | ||||||
| <summary>Using coroutines</summary> | ||||||
|
|
||||||
| ```kotlin | ||||||
| WebAuthProvider.login(account) | ||||||
| .withParameters(mapOf( | ||||||
| "experiment_id" to "<EXPERIMENT_ID>", | ||||||
| "variation_id" to "<VARIATION_ID>", | ||||||
| "segment_id" to "<SEGMENT_ID>" | ||||||
| )) | ||||||
| .await(this) | ||||||
| ``` | ||||||
|
|
||||||
| </details> | ||||||
|
|
||||||
| <details> | ||||||
| <summary>Using Java</summary> | ||||||
|
|
||||||
| ```java | ||||||
| WebAuthProvider.login(account) | ||||||
| .withParameters(new HashMap<String, Object>() {{ | ||||||
| put("experiment_id", "<EXPERIMENT_ID>"); | ||||||
| put("variation_id", "<VARIATION_ID>"); | ||||||
| put("segment_id", "<SEGMENT_ID>"); | ||||||
| }}) | ||||||
| .start(this, callback); | ||||||
| ``` | ||||||
|
|
||||||
| </details> | ||||||
|
|
||||||
| > [!NOTE] | ||||||
| > Experiment Center is an Enterprise feature. 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. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 3623 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- target excerpt ---'
sed -n '75,95p' examples/experiment-center.md
printf '%s\n' '--- nearby references ---'
rg -n -i "Experiment Center|development tenant|production tenant|Beta" examples README.md docs 2>/dev/null | head -80Repository: auth0/Auth0.Android Length of output: 1838 🌐 Web query:
💡 Result: In the context of the Auth0 Experiment Center, the service operates exclusively on development tenants during its Beta phase [1]. Production tenants are not supported for use with the Experiment Center while the feature is in Beta [1]. Additionally, during this Beta period, each tenant is limited to having no more than one experiment active at any given time [1]. Citations: Document the development-tenant limitation. During Beta, Experiment Center runs only on development tenants. Production tenants are not supported. Add this limitation to prevent production users from following an unsupported flow. Suggested wording- > Experiment Center is an Enterprise feature. The override only applies to the current request —
+ > Experiment Center is an Enterprise feature. During Beta, it runs only on development tenants; production tenants are not supported. The override only applies to the current request —📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: MCP tools |
||||||
| > | ||||||
| > Only `WebAuthProvider` login reaches Experiment Center. Embedded/native login and ROPG skip `/authorize` entirely and do not support experiment overrides. | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Update
README.mdin the same PR.This PR documents a new
WebAuthProvider.withParameters()integration pattern. Add the matchingREADME.mdupdate required by the repository guideline.As per coding guidelines: “Update
README.mdandEXAMPLES.mdin the same PR when changing public API, configuration, or integration patterns.”🤖 Prompt for AI Agents
Source: Coding guidelines