Skip to content

bug: Fail to isolate login flows when Using Multiple Nested AuthProvider Instances with unique instanceID #326

@kavindadimuthu

Description

@kavindadimuthu

Description

When nesting multiple AuthProvider components on a single page, the login process fails or behaves unpredictably, even when a unique instanceID is provided for each.

The SDK appears to have a race condition or state collision where it cannot determine which provider instance should process the authentication response. This results in the login flow executing out of order or failing to update the isAuthenticated state for the correct provider.

Expected Behavior

Each AuthProvider defined with a unique instanceID should operate in total isolation. Triggering a login on a specific instance should process the callback and update the state only for that instance, regardless of nesting depth.

Steps to Reproduce

  1. Setup: Initialize two separate AuthProvider components with distinct configurations and unique instanceID props (e.g., instance_A and instance_B).
  2. Nest: Place the second AuthProvider inside the component tree of the first AuthProvider (nested structure) in a single page.
  3. Action: Trigger the signIn() method specifically from the inner provider instance.
  4. Observe: After the redirect, notice that the inner provider fails to complete the login process, or the outer provider incorrectly attempts to intercept the authentication callback

Please select the area the issue is related to

@asgardeo/react, @asgardeo/browser, @asgardeo/javascript

Version

N/A

Environment Details (with versions)

No response

Reporter Checklist

  • I have searched the existing issues and this is not a duplicate.
  • I have provided all the necessary information.
  • I have tested the issue on the latest version of the package.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions