Skip to content

bug: Fails Authenticated API Calls When Multiple AsgardeoProvider Instances Are Used #329

@kavindadimuthu

Description

@kavindadimuthu

Description

When an application utilizes multiple instances of the AsgardeoProvider component, typically to support concurrent logins for different users or organizations within the same frontend application, authenticated API calls triggered via the SDK fail.

It appears that the SDK may not be correctly isolating the authentication state (tokens, HTTP client instances, or storage keys) between the different provider contexts. This results in the httpRequest or related API helpers failing to attach the correct Authorization header, or using the wrong token context.

Steps to Reproduce

  1. Initialize a React application.
  2. Wrap two different parts of the component tree with distinct AsgardeoProvider instances (e.g., Provider A for Org A and Provider B for Org B), configured with different credentials and scopes.
  3. Authenticate a user successfully in Provider A.
  4. Authenticate a different user successfully in Provider B.
  5. Attempt to make a secure API call using the httpRequest method from within a component wrapped by Provider B (or Provider A).

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