Google Authenticator iOS アプリを自動的に起動し、Objective-c コードからデータ (発行者、ユーザー、シークレット) を送信する方法は?
この質問は Swift では部分的に解決しますが、Objective-c を探しています。 iOS で Google Authenticator アプリを自動的に起動する
Google Authenticator iOS アプリを自動的に起動し、Objective-c コードからデータ (発行者、ユーザー、シークレット) を送信する方法は?
この質問は Swift では部分的に解決しますが、Objective-c を探しています。 iOS で Google Authenticator アプリを自動的に起動する
iOS 9 の時点で、最初に行う必要があるのは、これを Info.plist に追加して、URL スキームをホワイトリストに登録することです。
<key>LSApplicationQueriesSchemes</key>
<array>
<string>otpauth</string>
</array>
次に、Google Authenticator を起動するために必要なことは次のとおりです。
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];
}
• Google Authenticator URL を生成するための便利なページ。
• URL を解析するための Google の内部コードは、こちらで確認できます。