Skip to content

Add support for multiple Asgardeo Provider instances via optional instanceID#325

Merged
brionmario merged 4 commits intoasgardeo:mainfrom
kavindadimuthu:feat/multi-client-support
Feb 2, 2026
Merged

Add support for multiple Asgardeo Provider instances via optional instanceID#325
brionmario merged 4 commits intoasgardeo:mainfrom
kavindadimuthu:feat/multi-client-support

Conversation

@kavindadimuthu
Copy link
Contributor

@kavindadimuthu kavindadimuthu commented Jan 22, 2026

Purpose

This pull request introduces support for multiple authentication contexts ("multi-auth context") in the Asgardeo React SDK by adding an instanceId parameter throughout the authentication client and provider. This enables applications to manage multiple independent authentication sessions within the same app instance. The most important changes are grouped below:

Multi-auth context support:

  • Added an optional instanceId property to the AsgardeoReactConfig interface to allow configuration of multiple authentication contexts.
  • Updated the AsgardeoReactClient class to accept an instanceId in its constructor, store it, and provide a getInstanceId() method. The AuthAPI is now initialized with the instanceId as well.
  • Modified the AuthAPI class to accept and store an instanceId, pass it to the underlying SPA client, and expose a getInstanceId() method. [1] [2]
  • Updated the AsgardeoProvider React component to accept an optional instanceId prop (defaulting to 0), and to instantiate the AsgardeoReactClient with this value, ensuring correct context isolation.

Related Issues

Related PRs

  • N/A

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

* Defaults to 0 for backward compatibility.
*/
instanceId?: number;
} No newline at end of file
Copy link
Member

@brionmario brionmario Jan 29, 2026

Choose a reason for hiding this comment

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

Lets add instanceId?: number; to the top most Config interface:

  • /packages/javascript/src/models/config.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added instanceId?: number; to top most Config interface in @asgardeo/javascript package

import {AsgardeoBrowserConfig} from '@asgardeo/browser';

export type AsgardeoReactConfig = AsgardeoBrowserConfig;
export type AsgardeoReactConfig = AsgardeoBrowserConfig; No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export type AsgardeoReactConfig = AsgardeoBrowserConfig;
export type AsgardeoReactConfig = AsgardeoBrowserConfig;

@asgardeo-github-bot
Copy link

🦋 Changeset detected

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

@brionmario brionmario merged commit eb87859 into asgardeo:main Feb 2, 2026
3 of 6 checks passed
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.

feat: Support multiple Asgardeo Provider instances via optional instanceID

3 participants