I am opening my signUp link in InAppbrowser,after completion of signup,It show navigate to the login page in the App

76 Views Asked by At

I want to achieve this functionality of navigating to Login Page after signUp process completed in InAppBrowser.

I am using InAppBrowser from react-native-inappbrowser-reborn. I tried different codes but it didn`t work.

    const openLink = async (url) => {
     try {
      if (await InAppBrowser.isAvailable()) {
        InAppBrowser.open(url, {
          // Configure your InAppBrowser options here
          // ...
          dismissButtonStyle: "cancel",
          preferredBarTintColor: "white",
          preferredControlTintColor: "black",
          readerMode: false,
          animated: true,
          modalPresentationStyle: "fullScreen",
          modalTransitionStyle: "coverVertical",
          modalEnabled: true,
          enableBarCollapsing: false,
          // Android Properties
          showTitle: true,
          toolbarColor: "white",
          enableUrlBarHiding: true,
          enableDefaultShare: true,
          forceCloseOnRedirection: false,
        })
          .then((result) => {
            console.log("printing result", result);
            if (result.type === "loadstop") {
              // The "loadstop" event occurs when the page/resource finishes loading.
              const callbackUrl = result.url;
              console.log(`Received callback URL: ${callbackUrl}`);

              // Check if this is the callback URL you're expecting
              if (callbackUrl.startsWith("your-callback-url")) {
                // Handle the callback URL here
                // You can parse the URL and extract data as needed
              }
            }
          })
          .catch((error) => {
            console.error("InAppBrowser open error:", error);
          });
      } else {
        // Fallback to Linking if InAppBrowser is not available
        Linking.openURL(url);
      }
    } catch (error) {
      console.error("An error occurred:", error);
    }
  };

I tried various methods to get the url after success of my signUp process.

0

There are 0 best solutions below