在iOS上自动启动Google Authenticator应用 [英] Automatically launch Google Authenticator app on iOS

查看:459
本文介绍了在iOS上自动启动Google Authenticator应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有在iOS上启动Google Authenticator的受支持方式?

Is there a supported way of launching Google Authenticator on iOS?

我想让客户更轻松地打开应用程序并复制基于时间的代码,然后再将其粘贴回我的应用程序中.

I want to make it easier for customers to open the app and copy out the time-based code, before pasting it back into my app.

根据经验,我发现以下(快速)代码将启动该应用程序:

I've empirically discovered that this (Swift) code will launch the app:

UIApplication.sharedApplication().openURL(NSURL(string: "otpauth://")!)

...但是我想知道是否有更好的,受支持的方法.

...but I want to know if there is a better, supported way.

具体来说,是否支持otpauth://协议,而无需使用参数来简单启动应用程序?

Specifically, is the otpauth:// protocol supported without arguments to simply launch the app?

推荐答案

查看该应用程序的Git存储库,似乎他们已经为bot otpauthtotp

Looking at the Git repo for the app it does seem like they have registered the Custom URL Schemes for bot otpauth and totp

https://github .com/google/google-authenticator/blob/bd50d15c348a978c314d2b30e586fbc562096223/mobile/ios/OTPAuth-Info.plist#L42

还有这里

https://github .com/google/google-authenticator/blob/bd50d15c348a978c314d2b30e586fbc562096223/mobile/ios/Classes/OTPAuthURL.h#L23

这是有关如何准确构建url的文档:

And here is the documentation on how exactly to build the url:

https://github.com/google/google-authenticator/wiki/Key-Uri-Format

正确地形成它们并将您的应用程序和Google Authenticator应用程序放在同一台设备上后,您只需进行测试即可.

After you form them correctly and get your app and the Google Authenticator app on the same device you would just need to test.

这篇关于在iOS上自动启动Google Authenticator应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆