-
-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
While auth in progress, going to background closes the browser. #153
Comments
Please attach any reproducible demo |
Thanks for replying @jdnichollsc, I really appreciate the work you have done in this library. I will try and attach the demo. I did some more digging and it looks like on Android the issue only comes when "android:launchMode="singleTask"" and while reopening the application you click on the application rather than using app switcher. For iOS the issue not reproducible anymore. |
@jdnichollsc I'm also having this issue on Android. Here is working example I made. Simply clone and yarn. To reproduce:
I'm trying to help with a fix, but I need to understand exactly what the correct behaviour of this Many thanks for all your hard work with this library! |
What happen if you use the forceCloseOnRedirection option? 🤔 Honestly I don't know if we need to use |
I'm not sure if we need this |
I had the exact same problem and I've finally found a combination of settings that works for me. Try to set: InAppBrowser.open(url, {
...
forceCloseOnRedirection: false,
showInRecents: true,
...
} Strangely enough, it doesn't show a new task in the "recents" but it leaves the in-app browser on top of the original application and allows switching through other apps. Concretely, it creates the intent (the one that launches the chrome custom tab) without any flag, neither FLAG_ACTIVITY_NEW_TASK nor FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS/FLAG_ACTIVITY_NO_HISTORY. I'm a noob when it comes to the Android platform but here's my understanding:
Hope that helps! |
Above fix works when switching between the app. But when the app is opened by clicking on app icon the inapp browser gets closed. Any Solution for this |
Hello folks, do you have examples of another apps supporting this workflow? |
@jdnichollsc am not sure if Instagram is on react-native. But when you open any ad link which comes on feed screen it gets open in a similar kind of in-app browser. And when you put app in background and click on the app icon you can still see the link opened. |
@Kiran0791 any example using auth flow? :) |
I can confirm this is happening. |
@jdnichollsc I have an issue that may be related to this issue, I am trying to build a simple application to demonstrate the use of the library. It works really fine with iOS but I face strange behavior in Android here's a gif: And I have this response in the console:
And here is my simple code which is executed when I press on "Authorize": const url = `${URLS.authorizationEndpoint}?state=hello&client_id=${SECRETS.clientId}&redirect_uri=${URLS.redirectUrl}&response_type=token`;
try {
InAppBrowser.openAuth(url, URLS.redirectUrl, {
forceCloseOnRedirectionL: false,
showInRecents: true,
})
.then(async response => {
if (response.type === 'success' && response.url) {
const parsed = qs.parse(response.url);
await AsyncStorage.setItem('@SSO_CRDS', JSON.stringify(parsed))
.then(() => {
onSuccess && onSuccess();
})
.catch(e => alert(e));
}
})
.catch(err => console.log(err));
} catch (error) {
console.log(error);
} |
Same issue, when I switch between app using the recent screen the in-app browser is kept open but if I go back to the homescreen then click on the app icon, the in-app browser is dismissed...
Btw, thanks for this awesome lib ! |
Hey mate, please create another issue and attach a reproducible demo to be able to debug your error 👍 |
I encountered the same problem, and solved it using #213 (comment) It boils down that pressing the app icon in the launcher relaunches the activity which closes the browser when relaunched. Preventing a relauch from happening ensures the browser stays in place |
Did you manage to solve the problem for |
If I remember correctly, I didn't have any problem with iOS, it was already working for me... |
I have such issue on Android. I see that while the authenticate is processing. If the authorize URI is matched with your deeplinks declared on your android manifest. Then it will get back to your app and interrupt the authentication process before redirectUrl is called. Do you guys have any idea? |
Hey folks, can you help me to review the new Release 3.7.0 please? #375 |
While auth process, once the authentication is done it try to go back the app but the application gets closed without throwing error. In ios its working find but on android I'm facing problem. Kindly help me out to resolve this asap. |
anyone got any fixes or workaround for that? it is working totally fine in IOS. issue is only in android. `
|
@nitesh-habilelabs Been a while since I had worked with this but looking at my code it seems this same android issue I solved by passing a deep link url as a redirect one (second param of |
Hi @TamasSzigeti , Thank you for your help. It is fixed now. issue was with my intent filter. i had to pass host in that. |
I had to set showInRecents to true. |
@oailloud @jdnichollsc it is not working for ios. can you please help |
Platform: Both iOS and Android
Device: Device and emulator both.
Steps to reproduce:
Thanks
The text was updated successfully, but these errors were encountered: