ios - 在 objective-c 中从另一个 iOS 应用程序设置 Google Authenticator?

标签 ios objective-c google-authenticator

如何自动启动 Google Authenticator iOS 应用程序并从 Objective-c 代码发送数据(颁发者、用户、密码)?

这个问题部分解决了 Swift 但寻找 Objective-c。 Automatically launch Google Authenticator app on iOS

最佳答案

从 iOS 9 开始,您需要做的第一件事是将 url scheme 添加到您的 Info.plist 中,将其列入白名单

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>otpauth</string>
</array>

然后要启动 Google 身份验证器,您需要做的就是:

NSString *otpString = @"otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example";
NSURL *otpURL = [NSURL URLWithString:otpString];
if ([[UIApplication sharedApplication] canOpenURL:otpURL]) {
    [[UIApplication sharedApplication] openURL:otpURL];
}

• 有用 page用于生成 Google 身份验证器 URL。

• 您可以查看谷歌解析网址的内部代码here .

关于ios - 在 objective-c 中从另一个 iOS 应用程序设置 Google Authenticator?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33089093/

相关文章:

authentication - Google Authenticator - 缺少 otpauth 协议(protocol)参数

ios - 无效的条形码 - Google Authenticator - iOS - 用 = 填充

ios - Swift 自定义字体 Xcode

ios - 使用 Swift AVPlayer 显示视频轨道的时间码

iphone - 错误 :Terminating app due to uncaught exception 'NSInvalidArgumentException' , 原因:'-[NSCFNumber isEqualToString:]:

ios - 未导入到 Objective C 的 Swift 变量

ios - 一个项目中多个 UIImage+ImageEffects 文件

ios - 如何更改日历swift 3中的时间格式

ios - C 代码可以编译成任何架构的静态库吗?

java - 无法将字符串写入 FileWriter/BufferedWriter