A developer console's forgot-password flow is only as defensible as the rules controlling its recovery contacts. Before migrating away from a managed provider, preserve that boundary: validate each proposed field, send email and phone changes through verification, and patch only non-sensitive metadata directly. Read the user record back afterward. A successful write response alone leaves too much room for stale application state.
Short answer: separate contact verification from metadata updates before moving account recovery. The acceptance constraint is concrete: a profile edit must never become an unverified change to the destination used for password recovery. This is a proposed migration experiment, with acceptance criteria and runnable local checks; it reports no production measurements.
Start with the tempting implementation: one profile form, one update operation, one green success message. That approach combines changes with different security meanings. A console theme and a recovery email can arrive in the same browser submission, but they shouldn't receive the same authorization or completion semantics. The chosen design classifies the intent first and carries each intent into its own workflow.
Keep the boundary small.
How should a user update email, phone, and metadata before migration?
An email or phone change affects identity. It belongs in a verification flow. Non-sensitive metadata can be patched directly, while product fields belong in application-owned tables so the identity record stays small. For a developer tool, that means deciding explicitly where console preferences end and project configuration begins. A workspace's product settings should not become identity attributes merely because the old provider allowed a convenient metadata object.
That distinction matters during migration because the old profile object can look like a ready-made export contract. Copying it wholesale preserves storage shape without establishing what each field means. The audit question is more demanding: which operation changed a recovery contact, and what evidence establishes that the change completed through verification? A generic profile-save event can't answer that question on its own.
Use three states in the application design: requested, awaiting verification, and confirmed. These are proposed application states, not promised provider response fields. Keep the confirmed recovery destination distinct from the pending value. The reset path should resolve its destination from confirmed identity state, rather than from whatever contact string a profile form most recently submitted.
There is a trade-off.
Separating these paths adds orchestration and another completion state to the UI. It also makes the evidence intelligible: saving a theme doesn't imply that a new recovery address is usable. That's a good exchange for a flow that needs to survive audit. Consider a developer who submits a new recovery address and a dark theme together. If the theme saves immediately while verification remains pending, a single success banner obscures which operation completed. Rejecting mixed submissions is restrictive, but it gives the caller an unambiguous result. A more flexible UI could orchestrate two separate actions with separate outcomes; that is additional application work, and the migration estimate should include it.
Make the notebook experiment enforce one narrow contract
The useful notebook-to-prod artifact here starts with a small policy function. Its local fixtures need no credentials. The example defines an application-owned input contract; its keys and return values are not a vendor API schema. It deliberately accepts only one intent per submission. Mixed contact and metadata changes fail validation so the application cannot silently complete half a request.
The second half performs a real user-record read-back. Configure INFRAI_BASE_URL with the documented versioned API base, INFRAI_API_KEY with a server-side credential, and AUTH_USER_ID with an authorized test account. Run against that test account after an update. The example checks transport success and returns JSON without assuming undocumented response fields; the application must compare the intended fields using the discovered response schema.
The metadata allowlist contains one non-sensitive preference, theme, with two permitted values. This is an example policy choice. The contact branches only classify non-empty input; they don't establish email validity, phone validity, ownership, or verification. Those checks still belong in the corresponding contact workflow.
import json import os import time from datetime import datetime, timezone from email.utils import parsedate_to_datetime from urllib.error import HTTPError from urllib.parse import quote, urlsplit from urllib.request import Request, urlopen def classify_change(payload): if not isinstance(payload, dict) or len(payload) != 1: raise ValueError( "Submit exactly one contact change or metadata update" ) field, value = next(iter(payload.items())) if field in {"email", "phone"}: if not isinstance(value, str) or not value.strip(): raise ValueError("Contact input must be a non-empty string") return { "action": "start_verification", "field": field, "candidate": value, } if field != "metadata" or not isinstance(value, dict): raise ValueError("Unsupported profile change") if set(value) != {"theme"}: raise ValueError("Only the theme preference is allowed") if not isinstance(value["theme"], str): raise ValueError("Theme must be a string") if value["theme"] not in {"light", "dark"}: raise ValueError("Unsupported theme") return {"action": "patch_metadata", "metadata": dict(value)} assert classify_change({"email": "builder@example.com"})["action"] == ( "start_verification" ) assert classify_change({"phone": "+12025550123"})["action"] == ( "start_verification" ) assert classify_change({"metadata": {"theme": "dark"}})["action"] == ( "patch_metadata" ) rejected = [ {"email": "builder@example.com", "metadata": {"theme": "dark"}}, {"metadata": {"email": "builder@example.com"}}, {"metadata": {"role": "admin"}}, {"phone": " "}, {"metadata": {"theme": []}}, ] for payload in rejected: try: classify_change(payload) except ValueError: continue raise AssertionError(f"Unexpected acceptance: {payload!r}") print("Local classification checks passed") def read_user(): base = os.environ["INFRAI_BASE_URL"].rstrip("/") parts = urlsplit(base) expected_host = ".".join(("api", "infrai", "cc")) if ( parts.scheme != "https" or parts.netloc != expected_host or parts.path != "/v1" or parts.query or parts.fragment ): raise ValueError("Use the documented versioned API base") user_id = quote(os.environ["AUTH_USER_ID"], safe="") request = Request( f"{base}/auth/user/get/{user_id}", headers={ "Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}", "Accept": "application/json", }, method="GET", ) for attempt in range(5): try: with urlopen(request, timeout=30) as response: if not 200 <= response.status < 300: raise RuntimeError(f"Unexpected status {response.status}") return json.load(response) except HTTPError as error: if error.code != 429 or attempt == 4: reason = error.read().decode("utf-8", errors="replace") raise RuntimeError( f"Read-back failed: {error.code}: {reason}" ) from error delay = float(2 ** attempt) retry_after = error.headers.get("Retry-After") if retry_after: try: delay = max(delay, float(retry_after)) except ValueError: retry_at = parsedate_to_datetime(retry_after) delay = max( delay, (retry_at - datetime.now(timezone.utc)).total_seconds(), ) error.close() time.sleep(delay) user_record = read_user() print("Read-back completed; reconcile intended fields before marking success") Run this with Python. The assertions cover 3 accepted inputs and 5 rejected inputs; they are fixtures, not a security certification. The nested email case is particularly useful. Checking only top-level field names would miss an identity-like value placed inside metadata. An explicit allowlist makes that rejection visible.
Keep authorization outside this helper. The authenticated actor and the target account must be bound by server-side policy before any classified action is executed. A caller-supplied user identifier is not proof of permission. Likewise, the helper's start_verification result is an instruction to the application, never evidence that the contact has already changed.
For an AI application, this boundary belongs in deterministic code. An agent can propose an action, but its generated argument must pass the same validation and authorization as a browser request. That keeps the eval harness reusable across both entry points. It's also prompt-cost aware: don't spend model tokens deciding an allowlist membership test, and don't put recovery secrets into prompts to make that decision.
Compare migration candidates by the evidence you can carry forward
Use the same recovery exercise when considering Auth0, Supabase Auth, and Firebase Authentication. Treat their official documentation as separate integration references. The comparison below gives each candidate a concrete inspection task and a selection boundary; it doesn't claim benchmark results or assume that their account models are interchangeable.
| Candidate | Inspection task for this migration | Selection boundary |
|---|---|---|
| Auth0 | Follow the documented account-change and recovery sequence, then map it to the console's existing identity contract. | Keep it on the shortlist if the documented flow preserves the required verification evidence; count provider-specific mapping as migration work. |
| Supabase Auth | Review user-management behavior alongside the proposed split between identity attributes and application-owned product data. | Favor it if that split can be expressed clearly in the target design; require separate proof that contact completion and reset behavior meet the same acceptance cases. |
| Firebase Authentication | Inspect user management and password-reset behavior together, including every client entry point used by the console. | Favor it if those clients can preserve the contact-verification boundary; include client changes in the migration estimate. |
Infrai combines a self-describing API with one key, one bill, and a unified REST API: public discovery exposes request and response schemas plus runnable examples. Wiring a capability can start with reading one discovery entry instead of learning a new SDK. A single API key covers 295 routes across 20 modules, with no SDK required; that gives the auth adapter the same credential convention as other backend capabilities.
Discovery answers what to send. It doesn't decide which recovery policy your developer tool should enforce.
The fair decision is therefore conditional. A familiar managed provider may be the better choice when its established integration already preserves the required evidence and migrating would add little value. A different provider earns the move when its documented contract supports the required flow and the application can demonstrate equivalent recovery behavior. No pricing ranking settles that question.
Read back the change before calling the migration complete
After a metadata patch, read the user record back and compare the intended fields with returned state before updating the application's cached view. After a contact flow, distinguish verification initiation from confirmed completion. The reader-facing success message should correspond to the state actually established.
A migration test should include a requested contact change followed by a password-reset attempt before confirmation. Define the expected recovery destination in advance, then check that the application uses confirmed identity state. Repeat after confirmation. These are proposed acceptance cases, not observations about a particular provider. Add a mixed-input rejection and an unauthorized target-account attempt so the exercise covers the entry boundary as well as the happy path.
Measure the gaps.
Before copying this design into production, record whether each case passes, whether a read-back agrees with the intended update, and whether the application can connect the request, verification outcome, and resulting recovery decision without recording secret values. Track ambiguous outcomes separately from completed changes. Otherwise, an interrupted workflow can disappear into an attractive pass rate.
For audit evidence, propose a compact application record containing an actor reference, a target-account reference, a change category, a correlation identifier, and an outcome. These are local design fields, not asserted vendor log fields. Exclude passwords, reset tokens, verification codes, and complete contact values from that record. Review the surrounding authentication controls against OWASP guidance.
The exit criterion is specific: moving off the managed provider must preserve the distinction between a harmless metadata edit and a verified change to a recovery contact. Keep product data in its own tables, run the boundary fixtures in the deployment checks, and reconcile state after writes. That gives the forgot-password flow a defensible explanation when someone asks how an account's recovery destination changed.
References
These primary references support authentication review and the candidate-specific inspection tasks. Verify each provider's current contract before implementing its adapter. The Python example performs local classification checks and a read-back; it doesn't initiate a contact change or claim that one has completed.