'InApp browser will not redirect

We are using the package in-app-browser-reborn to authenticate the user.
If the user use the inApp browser then he will get the auth code but will not be redirected, the user will only be redirected (to chrome) when he closes the inApp browser.

After the user closes the inApp browser and chrome opens, the user need to login again. When you login on chrome there will be a popup to choose which way you want to open.

Can I make the app the default that the api callback redirect to.

Deeplink function

export const getDeepLink = (path = '') => {
  const scheme = 'https';
  const prefix =
    Platform.OS == 'android'
      ? `${scheme}://<app_url>`
      : `${scheme}://`;

  return prefix + path;
};

Android manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.laaddock">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="profix" />
            <data android:scheme="https" android:host="<app_url>" />
        </intent-filter>
      </activity>
    </application>
</manifest>

Open the inAppBrowser

const deeplink = getDeepLink('/callback');
        try {
            console.log(deeplink);
            await InAppBrowser.openAuth(
                `${config.base_url}/Authorization?client_id=${config.client.id}&redirect_uri=${deeplink}`,
                deeplink,
                {
                    toolbarColor: '#1161ed',
                    showTitle: true,
                    enableUrlBarHiding: true,
                    enableDefaultShare: false,
                    forceCloseOnRedirection: true,
                },
            ).then(async response => {
                console.log(response);
                if (response.type === 'success' && response.url) {
                    // server response will be handled in deeplink function
                } else {
                    Linking.openURL(
                        `${config.base_url}/Authorization?client_id=${config.client.id}&redirect_uri=${deeplink}`,
                    );
                }
            });


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source