@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/index.js CHANGED
@@ -1536,14 +1536,24 @@ var AsgardeoProvider = ({
1536
1536
  const currentUrl = new URL(window.location.href);
1537
1537
  const hasAuthParamsResult = hasAuthParams(currentUrl, afterSignInUrl);
1538
1538
  const isV2Platform = config.platform === Platform2.AsgardeoV2;
1539
- if (hasAuthParamsResult && !isV2Platform) {
1539
+ if (hasAuthParamsResult) {
1540
1540
  try {
1541
- await signIn(
1542
- { callOnlyOnRedirect: true }
1543
- // authParams?.authorizationCode,
1544
- // authParams?.sessionState,
1545
- // authParams?.state,
1546
- );
1541
+ if (isV2Platform) {
1542
+ const urlParams = currentUrl.searchParams;
1543
+ const code = urlParams.get("code");
1544
+ const flowIdFromUrl = urlParams.get("flowId");
1545
+ const storedFlowId = sessionStorage.getItem("asgardeo_flow_id");
1546
+ if (code && !flowIdFromUrl && !storedFlowId) {
1547
+ await signIn();
1548
+ }
1549
+ } else {
1550
+ await signIn(
1551
+ { callOnlyOnRedirect: true }
1552
+ // authParams?.authorizationCode,
1553
+ // authParams?.sessionState,
1554
+ // authParams?.state,
1555
+ );
1556
+ }
1547
1557
  } catch (error) {
1548
1558
  if (error && Object.prototype.hasOwnProperty.call(error, "code")) {
1549
1559
  }