-
Notifications
You must be signed in to change notification settings - Fork 1k
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
bug: DeepLinks not redirect back to App #3255
Comments
We have a similar issue on iOS and Android. On iOS we can reproduce it when using stored passwords. Sometimes after auto-filling the inputs the form is automatically submitted, in this case 'appUrlOpen' is not fired for the redirected deep link. When submitting the form manually, everything works. |
i wa sable to get it work but i needed to change your code, i added the appUrlOpen for IOS devices in your service and called the functions and teverything worked fine maybe i could show u the solution and u could adept it or help me to do it correctly |
If u still have this issue, i can provide a fully working example using capacitors Browser and (Community)Http Plugins. I haven't tested it yet on iOS but it is working on Android and in theory it should work to on iOS too. |
Because deep link event 'appUrlOpen' did not fire in some special cases as described above we now use cordova-plugin-inappbrowser:
With InAppBrowser you can clear the cache on each session, hide the URL bar, customize colors and more. You could even remove deep links completely: InAppBrowser provides the possibility to read the current URL with the 'loadstop' event, where you can process the Keycloak login redirect URL params. Since using InAppBrowser everything works like expected and setup without deep links is much simpler. |
But the op did say he's using cordovas inappbrowser and not capacitors browser plugin. Maybe changing browser could affect this issue. Yes, the setup and implementation with cordovas browser is simpler. For now, i still decided to go with capacitors Browser because the whole framework is newer/under heavy development and capacitor gets promoted by ionic in such way that i just can't imagine that they stop here (at least i hope that). |
We had the problems when using Capacitor Browser and deep links configured as described here: https://capacitorjs.com/docs/guides/deep-links I'd love to switch back to Capacitor Browser when it gets more flexible (hide URL bar, ...) and the issue is fixed. The easiest way to reproduce the issue for us was using stored passwords and let them pre-fill by iOS. Not always but in many cases 'appUrlOpen' did not fire. But the issue also affects Android. |
Whats your deeplink configuration? I had http as scheme and on Android the deeplink didn't work when being redirected directly to the redirectUrl because of an already active keycloak session. I changed the scheme to app:// and it started working on redirect too. |
We used a universal https:// link. Maybe app:// works, but I can't test in anymore. |
Ok, got it. Hopefully they fix this issue sooner or later |
Hi. |
I found a temporary solution. Do not use Browser.open with IOS and replace it with window.open (They are not good experience since the client exits the app and the browser opens, but it solves the problem), |
I found I could fix the problem of the appUrlOpen not firing by changing |
I had the same problem with |
This is a valid bug. For me as well in android everything works fine. For iOS same problem: |
yes, i have added App.addEventListener('open', () => {}) some like that. i
am not sure, if u want detailed information write me.
Am Di., 27. Apr. 2021 um 17:47 Uhr schrieb Saurav Singh <
***@***.***>:
… This is a valid bug for me in android everything works fine. For iOS same
problem:
Once deeplink is clicked the browser doesn't close and goes to the app. Is
there a workaround I can use for now?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3255 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABRRRWYBD6MSAQ7PBJKYEITTK3L7PANCNFSM4OZQ37AQ>
.
|
I followed the guide: https://capacitorjs.com/docs/guides/deep-links#ios-configuration And cannot get deep links working. Here's my app association file: open Here's my app.component.ts with the recommended and the
[EDIT] The workaround above worked:
why does this work? |
Hey,
Ah yeah sorry the listener App.addListener('appUrlOpen', (data: any) => {
is the correct one, sorry i didnt know the event anymore. and i checked my
code and it looks the same.
My Browser opening looks like this te
this.browserTab.isAvailable().then(available => {
if (available) {
this.browserTab.openUrl(url);
} else {
Browser.open({ url });
}
});
BrowserTab is the cordova-browser-tab package
private browserTab: BrowserTab,
and my fallback is of capacitor
const { Device, App, Browser } = Plugins;
this these are my npm packages
***@***.***/browser-tab"
***@***.***/core"
***@***.***/deeplinks"
***@***.***/in-app-browser"
***@***.***/native-storage"
"cordova-plugin-browsertab"
"cordova-plugin-compat"
"cordova-plugin-deeplinks"
"cordova-plugin-inappbrowser"
"cordova-plugin-ionic-webview"
"cordova-plugin-whitelist"
hope it can help ...
Am Mi., 28. Apr. 2021 um 06:39 Uhr schrieb Sante Kotturi <
***@***.***>:
… I followed the guide:
https://capacitorjs.com/docs/guides/deep-links#ios-configuration
And cannot get deep links working. Here's my app association file:
https://revillager.com/.well-known/apple-app-site-association
Xcode settings:
[image: image]
<https://user-images.githubusercontent.com/4960284/116346891-f8c17a00-a79f-11eb-901b-d612503b3d5e.png>
open https://revillager.com/tabs/home and nada. Website loads normally.
Nothing in Xcode fires.
Here's my app.component.ts with the recommended and the open event
listener:
initializeApp() {
this.platform.ready().then(() => {
console.log(
'[APP] Connected to database: ',
environment.firebase.projectId
);
this.statusBar.styleDefault();
SplashScreen.hide();
this.foregroundSvc.init();
this.analytics.init();
App.addListener('open', (data: any) => {
console.log('[DEEP LINK ALT], ', data);
})
App.addListener('appUrlOpen', (data: any) => {
this.zone.run(() => {
console.log('[DEEP LINK] caught: ', data, data.url);
// Example url: https://revillager.com/tabs/tab2
// slug = /tabs/tab2
const slug = data.url.split('.com').pop();
console.log('[DEEP LINK] slug: ', slug);
if (slug) {
this.router.navigateByUrl(slug);
}
// If no match, do nothing - let regular routing
// logic take over
});
});
});
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3255 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABRRRW7Y6Y2EOAANYN4UFSDTK6GORANCNFSM4OZQ37AQ>
.
|
App.addListener('appUrlOpen', ({ url: fragment }) => {
const decodeURI = decodeURIComponent(fragment);
this.zone.run(() => {
....some logic
});
});
Am Mi., 28. Apr. 2021 um 14:48 Uhr schrieb J S ***@***.***>:
… Hey,
Ah yeah sorry the listener App.addListener('appUrlOpen', (data: any) => {
is the correct one, sorry i didnt know the event anymore. and i checked my
code and it looks the same.
My Browser opening looks like this te
this.browserTab.isAvailable().then(available => {
if (available) {
this.browserTab.openUrl(url);
} else {
Browser.open({ url });
}
});
BrowserTab is the cordova-browser-tab package
private browserTab: BrowserTab,
and my fallback is of capacitor
const { Device, App, Browser } = Plugins;
this these are my npm packages
***@***.***/browser-tab"
***@***.***/core"
***@***.***/deeplinks"
***@***.***/in-app-browser"
***@***.***/native-storage"
"cordova-plugin-browsertab"
"cordova-plugin-compat"
"cordova-plugin-deeplinks"
"cordova-plugin-inappbrowser"
"cordova-plugin-ionic-webview"
"cordova-plugin-whitelist"
hope it can help ...
Am Mi., 28. Apr. 2021 um 06:39 Uhr schrieb Sante Kotturi <
***@***.***>:
> I followed the guide:
> https://capacitorjs.com/docs/guides/deep-links#ios-configuration
>
> And cannot get deep links working. Here's my app association file:
> https://revillager.com/.well-known/apple-app-site-association
>
> Xcode settings:
> [image: image]
> <https://user-images.githubusercontent.com/4960284/116346891-f8c17a00-a79f-11eb-901b-d612503b3d5e.png>
>
> open https://revillager.com/tabs/home and nada. Website loads normally.
> Nothing in Xcode fires.
>
> Here's my app.component.ts with the recommended and the open event
> listener:
>
> initializeApp() {
> this.platform.ready().then(() => {
> console.log(
> '[APP] Connected to database: ',
> environment.firebase.projectId
> );
> this.statusBar.styleDefault();
> SplashScreen.hide();
> this.foregroundSvc.init();
> this.analytics.init();
>
> App.addListener('open', (data: any) => {
> console.log('[DEEP LINK ALT], ', data);
> })
>
> App.addListener('appUrlOpen', (data: any) => {
> this.zone.run(() => {
> console.log('[DEEP LINK] caught: ', data, data.url);
> // Example url: https://revillager.com/tabs/tab2
> // slug = /tabs/tab2
> const slug = data.url.split('.com').pop();
> console.log('[DEEP LINK] slug: ', slug);
> if (slug) {
> this.router.navigateByUrl(slug);
> }
> // If no match, do nothing - let regular routing
> // logic take over
> });
> });
> });
> }
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#3255 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABRRRW7Y6Y2EOAANYN4UFSDTK6GORANCNFSM4OZQ37AQ>
> .
>
|
@SheppardX |
For me its bot opening Safari thats the Problem,
Its musst open the browsertab or the Browser of capacitor this is a
chromium Browser I think.
With the Code I postet my app is not opening Safari.
Saurav Singh ***@***.***> schrieb am Do., 29. Apr. 2021,
09:33:
… @SheppardX <https://github.com/SheppardX>
Im using this for oauth process.
Yes I im getting the data to the listener for ios so my universal link is
setup correctly. but the in-app-browser (safari) is not closing
automatically/taking me back to the app.
Is it the same for you?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3255 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABRRRWYATSAMT2I7RONX3UDTLEDT3ANCNFSM4OZQ37AQ>
.
|
Okay I see. I just get this opinion that universal links for ios in general has alot of problems. Hmm I would love to solve this and even contribute to the plugin. But atm I have no idea what could be going wrong. |
Hi @SheppardX,
|
yeah hier is from keycloak sevice
and in the deeplink service i added
|
App plugin is now a separate package. For the "Browser does not close on iOS" issue, that's how iOS works, when a deep link opens your app, it opens it in the current status, so if you had a browser of other window present, it will be there. Capacitor's browser plugin offers a "close" method you can use to close the browser window, other plugins might have similar methods. |
Hello |
I'm also curious, as I have exact the same issue. Although I have https links associated and for example when opening in the notes application I get redirected to the app, but inside the InAppBrowser the website is loaded and no redirect to the app happens. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out. |
Bug Report
Capacitor Version
Platform(s)
IOS
Current Behavior
We are using cmotion/ionic-keycloak-auth.
Opens Keycloak in BrowserTab for redirecting its Using DeepLinks.
After Login Success it should close the browser and save the token in the storage.
Android works perfect.
In Ios the DeepLink is not fired, **App.addListener('appUrlOpen' ** gets called.
i have setup all URL Scheme`s if i delete them Safari tells me about unknown URL.
Expected Behavior
Browser Close after Successfull login
Code Reproduction
Install cmotion/ionic-keycloak-auth and try to login with IOS
Other Technical Details
npm --version
output: 6.14.6node --version
output: v12.11.0pod --version
output (iOS issues only): 1.9.3Additional Context
I already posted directly in cmotion github but doesnt get an answer
vymalo/ionic-keycloak#8
The text was updated successfully, but these errors were encountered: