Skip to content

feat: Expose isRetryable property on CredentialsManagerException, ApiException, and WebAuthenticationException#786

Merged
utkrishtsahu merged 11 commits intomainfrom
SDK-8093-Expose-isRetryable-property-on-CredentialsManagerException
Mar 31, 2026
Merged

feat: Expose isRetryable property on CredentialsManagerException, ApiException, and WebAuthenticationException#786
utkrishtsahu merged 11 commits intomainfrom
SDK-8093-Expose-isRetryable-property-on-CredentialsManagerException

Conversation

@utkrishtsahu
Copy link
Copy Markdown
Contributor

@utkrishtsahu utkrishtsahu commented Mar 23, 2026

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

Adds the isRetryable property to CredentialsManagerException, ApiException, and WebAuthenticationException to indicate whether a failure is transient and can be retried.

Dart: Added bool get isRetryable to WebAuthenticationException, which reads _isRetryable from the details map. Added bool get isRetryable to ApiException, which delegates to existing isNetworkError flag (no native changes needed).
Android: Updated LoginWebAuthRequestHandler and LogoutWebAuthRequestHandler to pass mapOf("_isRetryable" to exception.isNetworkError) as error details.
iOS: Extended FlutterError(from: WebAuthError) to include _isRetryable in the details dictionary. Returns true for network-related AuthenticationError and URLError. Returns false for all other cases.
Docs: Updated EXAMPLES.md with isRetryable usage examples for ApiException and WebAuthenticationException.

📎 References

SDK-8093

🎯 Testing

Unit tests added:

  • Dart: Tests that isRetryable returns the correct value based on _isRetryable/isNetworkError flags for ApiException and WebAuthenticationException.
  • Android (Kotlin): Updated LoginWebAuthRequestHandlerTest and LogoutWebAuthRequestHandlerTest to verify _isRetryable in error details map.
  • iOS (Swift): Tests for non-retryable WebAuth errors and verification that _isRetryable is present and is Bool in details dictionary.
    Manual testing:
    Verified on Android device (Pixel 7a) and iOS simulator (iPhone 17 Pro) using the example app — tested WebAuth login cancel, WebAuth logout (not logged in), API login with bad credentials, getCredentials, renewCredentials, and clearCredentials + getCredentials scenarios. Confirmed isRetryable is false for permanent errors and correctly propagated through the platform channel on both platforms.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an isRetryable signal to CredentialsManagerException so Flutter apps can distinguish transient credential-operation failures (safe to retry) from permanent ones (should not retry).

Changes:

  • Added CredentialsManagerException.isRetryable in the platform interface, sourced from _isRetryable in PlatformException.details.
  • Propagated _isRetryable from native layers: Android via CredentialsManagerException.toMap(), and iOS/macOS via FlutterError(from: CredentialsManagerError) details enrichment.
  • Added unit tests and updated examples documentation to describe platform behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
auth0_flutter_platform_interface/lib/src/credentials-manager/credentials_manager_exception.dart Adds isRetryable getter reading _isRetryable from details.
auth0_flutter_platform_interface/test/credential_manager_exception_test.dart Adds tests covering isRetryable true/false/missing flag behavior.
auth0_flutter/android/src/main/kotlin/com/auth0/auth0_flutter/CredentialsManagerExceptionExtensions.kt Introduces CredentialsManagerException.toMap() that sets _isRetryable based on network AuthenticationException.
auth0_flutter/android/src/main/kotlin/com/auth0/auth0_flutter/request_handlers/credentials_manager/GetCredentialsRequestHandler.kt Sends exception.toMap() as error details to Flutter.
auth0_flutter/android/src/main/kotlin/com/auth0/auth0_flutter/request_handlers/credentials_manager/RenewCredentialsRequestHandler.kt Sends exception.toMap() as error details to Flutter.
auth0_flutter/android/src/main/kotlin/com/auth0/auth0_flutter/request_handlers/credentials_manager/GetSSOCredentialsRequestHandler.kt Sends exception.toMap() as error details to Flutter.
auth0_flutter/android/src/test/kotlin/com/auth0/auth0_flutter/CredentialsManagerExceptionExtensionsTest.kt Adds tests for Android _isRetryable mapping across different causes.
auth0_flutter/darwin/Classes/CredentialsManager/CredentialsManagerExtensions.swift Adds _isRetryable to FlutterError details with retryability rules for renew/network/biometrics.
auth0_flutter/example/ios/Tests/Utilities.swift Strengthens assertion to verify _isRetryable exists and is a Bool in details.
auth0_flutter/example/ios/Tests/CredentialsManager/CredentialsManagerExtensionsTests.swift Adds iOS tests asserting retryability for specific CredentialsManagerError cases.
auth0_flutter/EXAMPLES.md Documents isRetryable usage and platform behavior notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread auth0_flutter/EXAMPLES.md Outdated
@utkrishtsahu utkrishtsahu changed the title feat: add isRetryable property to CredentialsManagerException feat: Expose isRetryable property on CredentialsManagerException, ApiException, and WebAuthenticationException Mar 26, 2026
…ryable-property-on-CredentialsManagerException
Comment thread auth0_flutter/darwin/Classes/WebAuth/WebAuthExtensions.swift Outdated
@utkrishtsahu utkrishtsahu merged commit b67744c into main Mar 31, 2026
11 checks passed
@utkrishtsahu utkrishtsahu deleted the SDK-8093-Expose-isRetryable-property-on-CredentialsManagerException branch March 31, 2026 08:13
This was referenced Apr 15, 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.

4 participants