EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 365 forks source link

BankID difficulties #299

Open petercutting opened 5 years ago

petercutting commented 5 years ago

.1) My App needs to start BankID .X) user enters passphrase into BankID app .2) BankID needs to start my App

Things seem to be working on Android. On iOS BankID launches but I cannot get it to redirect back to my App ie 2). I guess Android works because 2) is just a Back operation. On iOS it is more complex.

This plugin advertises itself as "launch your app by a link like this: mycoolapp://" . which is 2) above. The funny thing is my app can also do 1) (ie start another app) as long as I have the following BankID URL_SCHEME parameter in config.xml

<plugin name="cordova-plugin-customurlscheme" spec="4.4.0" source="npm">
    <param name="URL_SCHEME" value="bankid" />
</plugin>

So I seem to be using the plugin in the wrong drirection.

The BankID documentation sais I must :- "register a Universal Link or a custom URL scheme to make it possible for the BankID app to re-launch (my) app". Universal Link looks very complex so I hope I can avoid it.

I would expect that I would name myapp (where bankid is) above. so that BankID can launch it using the redirect that I provide

window.open('bankid://?redirect=', '_system')

To sum up, on iOS, I seem to be able to use this plugin to start another app (going against the spec), and I cannot seem to use it to do what it is specieifed to do, ie make my app startable

confused

petercutting commented 5 years ago

I seem to have fixed it. I was starting bankid the wrong way. I was using bankid:// but now use https://app.bankid.com/

this means that I can change to

so now I can configure bankid to redirect back to myapp://

This works but unfortunately I have a new error which is that the redirect seems to start myapp instead of resuming it

frebe73 commented 4 years ago

Would you mind telling some more about how to start BankID from a Cordova app? My email is fredrik@maxpa.se

ShizaS commented 3 years ago

I seem to have the same issue. I'm even using the correct URL to start bankId https://app.bankid.com/. But the redirect link doesn't go back to my ios flutter app. Custom URL is working fine as well. Can u help me give some pointers what could be the issue.

petercutting commented 3 years ago

getting the bankid app to redirect back to my app was tricky but it works.

It seems that the scheme can only be set once (using Cordova). I have multiple schemes for dev, test , prod so when building a different scheme I must start from scratch

So I must recreate the iOS platform, which is unfortunate (XCode), but required in order to recreate the customurlscheme plugin with the desired scheme

cordova platform rm ios
cordova platform add ios@6.1.1
cordova plugin rm cordova-plugin-customurlscheme
cordova plugin add cordova-plugin-customurlscheme --variable URL_SCHEME=${appBundleid}
ShizaS commented 3 years ago

it seems the customUrl schemes in ios are working fine but there's some issue with redirection from bankID. What do u think?

petercutting commented 3 years ago

well it is my understanding that customurlscheme is used to define the scheme of the app so that the bankid app has something to redirect back to