Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically launch Google Authenticator app on iOS

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.

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

like image 584
Daniel Avatar asked Nov 10 '22 07:11

Daniel


1 Answers

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

And here

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

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

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

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

like image 161
Dieskim Avatar answered Nov 15 '22 12:11

Dieskim