简体   繁体   English

在 iOS (Flutter) 中使用自定义 URL 方案从 BankID 应用程序重定向不起作用

[英]Redirecting from BankID app with custom URL scheme in iOS (Flutter) not working

I'm trying to redirect from BankId app to my Flutter app after the user enters the security code.在用户输入安全代码后,我试图从 BankId 应用程序重定向到我的 Flutter 应用程序。

It's working fine in Android but in iOS when I set URL redirect to my custom URL scheme, it doesn't return back to the app automatically.它在 Android 中运行良好,但在 iOS 中,当我将 URL 重定向到我的自定义 URL 方案时,它不会自动返回到应用程序。

 if (Platform.isIOS) {
 const redirect = "rememberapp://";
 url = "https://app.bankid.com/?autostarttoken=[$autoToken]&redirect=$redirect";
 if (await canLaunch(url)) {
   await launch(url, forceSafariVC: false);
 } else {
   throw 'Could not launch $url';
 }}

When I add the URL scheme in safari, it opens up the app but it's not working when I try to redirect from another app.当我在 safari 中添加 URL 方案时,它会打开该应用程序,但当我尝试从另一个应用程序重定向时它不起作用。

For redirect URL in IOS, you need to first setup deep linking in your application.对于 IOS 中的重定向 URL,您需要首先在您的应用程序中设置深度链接。 Steps:脚步:

  • Register a custom URL注册定制URL
  • listen for your custom URL inside application by configuring scheme, host, and path通过配置方案、主机和路径来监听您的自定义 URL 内部应用程序
  • Finally, now that your application is set up to listen for specific url, add that url as redirect.最后,既然您的应用程序已设置为侦听特定的 url,请将 url 添加为重定向。

Finally, launch your Swedish BankID application with this format:最后,使用以下格式启动您的 Swedish BankID 应用程序:

let url = URL(string: "https://app.bankid.com/?redirect=https://com.sampleapp.deeplink.app/") UIApplication.shared.open(url,: options. [:universalLinksOnly:true]) { (success) in / handle success/failure } let url = URL(string: "https://app.bankid.com/?redirect=https://com.sampleapp.deeplink.app/") UIApplication.shared.open(url,: 选项。[:universalLinksOnly: true]) { (success) in / handle success/failure }

First of all, try this BankId redirect without a token and without creating a bankiD test account as Bank id will generate an error of no existing account but it will redirect you back to your application automatically.首先,尝试在不使用令牌且不创建 bankiD 测试帐户的情况下进行此 BankId 重定向,因为银行 ID 会生成“不存在帐户”的错误,但它会自动将您重定向回您的应用程序。

After successfully testing your deep link, create a test BankID account and start user verification with Signicat Express Authentication REST API (see high-level documentation here: https://developer.signicat.com/express/docs/identification/#guides and detailed API reference here: https://developer.signicat.com/express/apis/authentication.html#tag/Sessions )成功测试您的深层链接后,创建一个测试 BankID 帐户并使用 Signicat Express 身份验证 REST API 开始用户验证(请参阅此处的高级文档: https://developer.signicat.com/express/docs/identification/#guides和详细信息API 参考: https://developer.signicat.com/express/apis/authentication.html#tag/Sessions )

Or you start user verification with Signicat so-called “headless” flow https://api.signicat.io/identification/v2/sessions或者您使用 Signicat 所谓的“无头”流程开始用户验证https://api.signicat.io/identification/v2/sessions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM