Skip to content

Conversation

@kavindadimuthu
Copy link
Contributor

This pull request fix the isolation of login flows when Using Multiple AuthProvider Instances. The changes ensure that authentication flows and storage are correctly scoped to each instance, preventing conflicts when multiple auth clients are used in the same application. The update also adds utilities to detect if the current URL is intended for a specific instance.

Key changes include:

Multi-auth instance support in authClient:

  • Updated the legacy AsgardeoAuthClient to use an instance property for instanceID instead of a static class property, ensuring each client instance is independent. Storage keys and state parameters now include the correct instanceId. [1] [2] [3] [4]

URL utilities and authentication flow:

  • Added the hasCalledForThisInstanceInUrl utility to check if the current URL's state parameter matches the expected instance, and exported it from the browser SDK. [1] [2]
  • Updated the useBrowserUrl React hook and AsgardeoProvider to use the new utility, ensuring authentication callbacks are processed only by the correct client instance. [1] [2] [3] [4] [5]

Related Issues

Related PRs

Checklist

  • Followed the CONTRIBUTING guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Unit tests provided. (Add links if there are any)

Security checks

@asgardeo-github-bot
Copy link

⚠️ No Changeset found

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go.

If these changes should result in a version bump, you need to add a changeset.

Refer Release Documentation to learn how to add a changeset.

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.

2 participants