@asgardeo/react 0.6.10 → 0.6.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1642,14 +1642,24 @@ var AsgardeoProvider = ({
1642
1642
  const currentUrl = new URL(window.location.href);
1643
1643
  const hasAuthParamsResult = hasAuthParams(currentUrl, afterSignInUrl);
1644
1644
  const isV2Platform = config.platform === import_browser12.Platform.AsgardeoV2;
1645
- if (hasAuthParamsResult && !isV2Platform) {
1645
+ if (hasAuthParamsResult) {
1646
1646
  try {
1647
- await signIn(
1648
- { callOnlyOnRedirect: true }
1649
- // authParams?.authorizationCode,
1650
- // authParams?.sessionState,
1651
- // authParams?.state,
1652
- );
1647
+ if (isV2Platform) {
1648
+ const urlParams = currentUrl.searchParams;
1649
+ const code = urlParams.get("code");
1650
+ const flowIdFromUrl = urlParams.get("flowId");
1651
+ const storedFlowId = sessionStorage.getItem("asgardeo_flow_id");
1652
+ if (code && !flowIdFromUrl && !storedFlowId) {
1653
+ await signIn();
1654
+ }
1655
+ } else {
1656
+ await signIn(
1657
+ { callOnlyOnRedirect: true }
1658
+ // authParams?.authorizationCode,
1659
+ // authParams?.sessionState,
1660
+ // authParams?.state,
1661
+ );
1662
+ }
1653
1663
  } catch (error) {
1654
1664
  if (error && Object.prototype.hasOwnProperty.call(error, "code")) {
1655
1665
  }