Skip to content

Conversation

@subhankarmaiti
Copy link
Contributor

@subhankarmaiti subhankarmaiti commented Dec 17, 2025

API Changes:

  • clearApiCredentials(audience, scope?) - Now accepts optional scope parameter

@subhankarmaiti subhankarmaiti requested a review from a team as a code owner December 17, 2025 05:06
sanchitmehta94
sanchitmehta94 previously approved these changes Dec 17, 2025
Copy link

@sanchitmehta94 sanchitmehta94 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

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 optional audience and scope parameters to the clearCredentials and clearApiCredentials methods across all platforms, enabling more granular credential management. When an audience is provided to clearCredentials, it delegates to clearApiCredentials for consistency.

  • Added optional audience and scope parameters to clearCredentials method
  • Added optional scope parameter to clearApiCredentials method
  • Updated TypeScript interfaces, native bridge implementations (iOS/Android), and web platform adapter
  • Added comprehensive test coverage for new parameter combinations

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/specs/NativeA0Auth0.ts Updated TurboModule spec with optional parameters for clearing credentials
src/core/interfaces/ICredentialsManager.ts Updated interface documentation to reflect optional audience/scope filtering
src/platforms/native/bridge/INativeBridge.ts Added JSDoc and optional parameters to bridge interface methods
src/platforms/native/bridge/NativeBridgeManager.ts Updated to pass optional parameters through to native module
src/platforms/native/adapters/NativeCredentialsManager.ts Updated to accept and forward optional parameters to bridge
src/platforms/native/adapters/tests/NativeCredentialsManager.spec.ts Added tests for clearing credentials with various parameter combinations
src/platforms/web/adapters/WebCredentialsManager.ts Delegates to clearApiCredentials when audience is provided; updates warning messages with scope info
src/platforms/web/adapters/tests/WebCredentialsManager.spec.ts Added tests for delegation behavior and scope handling in warning messages
ios/NativeBridge.swift Implements conditional clearing logic based on audience parameter
ios/A0Auth0.mm Updated method signature to accept nullable audience and scope parameters
android/src/main/oldarch/com/auth0/react/A0Auth0Spec.kt Updated abstract methods with nullable parameters
android/src/main/java/com/auth0/react/A0Auth0Module.kt Implements conditional clearing logic with null-safe parameter handling
EXAMPLES.md Added examples demonstrating new optional parameters usage
Comments suppressed due to low confidence (1)

ios/NativeBridge.swift:257

  • The DPoP key is being cleared even when clearing credentials for a specific audience. Since the DPoP key is a global resource (not specific to any audience), it should only be cleared when clearing all credentials (i.e., when audience is null/undefined). Clearing it when removing credentials for a specific audience could affect other API credentials that still need the DPoP key. Consider moving the DPoP clearing logic inside the else block where all credentials are cleared.
        // Also clear DPoP key if DPoP is enabled
        if self.useDPoP {
            do {
                try DPoP.clearKeypair()
            } catch {
                // Log error but don't fail the operation
                print("Warning: Failed to clear DPoP key: \(error.localizedDescription)")
            }
        }

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

@subhankarmaiti subhankarmaiti changed the title feat: add optional audience and scope parameters to clearCredentials and clearApiCredentials feat: add optional scope parameters clearApiCredentials Dec 17, 2025
@subhankarmaiti subhankarmaiti changed the title feat: add optional scope parameters clearApiCredentials feat: add optional scope parameter to clearApiCredentials Dec 17, 2025
Comment on lines -52 to -57
try {
await this.bridge.clearDPoPKey();
} catch {
// Silently ignore DPoP key clearing errors
// The main credentials are already cleared at this point
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need to call this. As we are calling it in the native module

pmathew92
pmathew92 previously approved these changes Dec 17, 2025
@subhankarmaiti subhankarmaiti merged commit 8dc84ac into master Dec 17, 2025
4 checks passed
@subhankarmaiti subhankarmaiti deleted the feat/credentials-clear-audience-scope branch December 17, 2025 08:27
@subhankarmaiti subhankarmaiti mentioned this pull request Dec 18, 2025
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