Skip to content

refactor(embedded): replace boolean accessors with typed EmbeddedAuthError - #1079

Merged
pmathew92 merged 4 commits into
v5_developmentfrom
refactor/embedded-auth-error-typed
Oct 5, 2026
Merged

pmathew92 merged 4 commits into
v5_developmentfrom
refactor/embedded-auth-error-typed

Conversation

@pmathew92

@pmathew92 pmathew92 commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Description

Refactors EmbeddedAuthException to classify failures through a single strongly-typed EmbeddedAuthError sealed interface (EmbeddedAuthException.error), replacing the eight boolean is* accessors and the top-level nextActions field.

What changed

  • New public type EmbeddedAuthError — sealed interface, 10 variants: InsufficientAuthorization(nextActions) (data class) plus data objects TooManyWrongOtpAttempts, ChallengeExpired, AccessDenied, TooManyAttempts, TooManyLogins, SessionExpired, Network, NoActiveSession, Unknown.
  • EmbeddedAuthException — exposes error; removed the 8 is* accessors and moved nextActions onto InsufficientAuthorization (only the recoverable case carries next steps).
  • Centralised classification in a single embeddedAuthErrorAdapter() mapping (statusCode, code, description, cause) → EmbeddedAuthError. All invalid_grant maps to SessionExpired (no phase split).
  • Session lifecycle (updateSessionFromFailure) — InsufficientAuthorization adopts the rotated auth_session; Network preserves the session for an in-place retry; every other error clears it, forcing a fresh authorize(). (Token-exchange failures continue to leave the session intact via AdvancingRequest, independent of this rule.)

Checklist

  • Unit tests for success and error paths
  • Callback + coroutine (await) parity covered
  • Explicit visibility / return types (explicit-API mode)

@pmathew92
pmathew92 requested a review from a team as a code owner September 30, 2026 12:26
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: f4bca7e0-c0f5-445a-bfa2-f6556f6773d8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@NandanPrabhu
NandanPrabhu self-requested a review September 30, 2026 12:35
Comment thread auth0/src/main/java/com/auth0/android/embedded/EmbeddedAuthError.kt
Comment thread auth0/src/main/java/com/auth0/android/embedded/EmbeddedAuthError.kt
utkrishtsahu
utkrishtsahu previously approved these changes Oct 1, 2026

@utkrishtsahu utkrishtsahu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

) : EmbeddedAuthError {

public enum class Reason {
/** a plain step-forward continuation. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"invalid_identifier_or_code" "invalid_code" "authorization_pending" "slow_down" "invalid_identifier_or_password" enums that can come under insufficient authorization. do we need add all these?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not now. We can add when those scenarios come in the next milestones

@pmathew92
pmathew92 merged commit ce1450c into v5_development Oct 5, 2026
7 checks passed
@pmathew92
pmathew92 deleted the refactor/embedded-auth-error-typed branch October 5, 2026 02:57
@pmathew92 pmathew92 mentioned this pull request Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants