Developers: Here’s how to add a little 1Password to your iOS apps (Update 2x)

Use 1Password to login

Use 1Password to login to Riposte for App.net

Hey developers, know what your apps and 1Password for iOS have in common? They’re two great tastes that taste even better together, thanks to some of the URL schemes we added to 1Password 4.1 for iOS. Here’s how to get a little slice of 1Password into your apps to make the login and web browsing experiences even better for both our customers.

Plus, check out all the Apps that Love 1Password to get some ideas!

What we support so far

Without saying more than I’m allowed, we’re seeing fantastic interest from developers who want to build some 1Password support into their apps, so here is what we support so far:

  • a URL scheme for switching to 1Password to search item titles for a custom term, usually a service name like “twitter” or “evernote”. This speeds up the process for the user so they can copy something like their password and get back to your app
  • setting 1Password for iOS as an external browser. More and more users want this option as they are using our new AutoFill form-filling tools to login and shop right on their iPhone and iPad

There are a couple things we don’t support yet, but we’re looking at: the ability to search more than just the item titles, and a way to roundtrip the user back to your app once they do something in 1Password, such as copy data to the clipboard. For now, users need to use iOS’s default app switch method—double-tap the Home button, then tap your app to switch back.

Examples

Riposte for App.net provides a great example of how useful it is to integrate 1Password into your app. As a personal user and fan of App.net, I’m a pretty happy camper.

If Riposte finds that 1Password for iOS is installed (more on that in a minute), it presents a 1Password button right on the login screen! Tap it and you’ll switch to 1Password, where you can enter your Master Password (if necessary to unlock) and see that “app.net” has been auto-inserted in the search box to quickly filter results for you.

When using Riposte’s in-app browser, you can also tap the action arrow, then tap the 1Password option (again, the button only appears if Riposte sees it’s installed) to auto-search 1Password for the user’s Login for that site. This makes it easier for users to quickly use their 1Password Login for that site from within your app, instead of having to switch to another browser.

Of course, there is also Launch Center Pro, a fantastic iPhone productivity utility that has long had support for doing a few things faster with 1Password. It was the first to adopt our new URL schemes, so you can create quick actions to search 1Password for, say, the contents of your clipboard or a custom term, or open HTTP and HTTPS URLs in 1Password’s new Web Mode.

Download our icon pack

You’ll probably want our icon to place a button like you see in Riposte. Here is a pack of icons you can use, but get in touch if these don’t fit the bill. Update 4-19-2013: we updated this pack to include a couple monochrome icons at various sizes for things like the iOS sharing sheet.

Check if 1Password is installed

The first thing you probably want to do is find out whether 1Password is installed. This should help:

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"onepassword://search"]]) {
 NSLog(@"1Password is installed!");
}

Make it easier to login, auto-search 1Password

If your app uses a service that your users log into—whether it’s Twitter, App.net, or something homegrown—you can display a 1Password button and pass a search term with a simple URL like this:

onepassword://search/twitter

Or you can do it with code:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"onepassword://search/twitter.com"]];

This is also a useful way to let users switch from your in-app browser to quickly search 1Password for a Login for the page they’re on.

Open URLs externally, set 1Password as the default external browser

You can open URLs in 1Password (essentially like the ‘Open in Safari’ option) simply by inserting “op” in front of them:

ophttp:// or ophttps://

You can also use this code, then have UIApplication open that URL:

NSString *browser = [[NSUserDefaults standardUserDefaults] stringForKey:kPreferredBrowser];
	NSURL *url;
	if ([browser isEqualToString:@"1Password"]) {
		url = [NSURL urlWithString:[@"op" stringByAppendingString:urlString]];
	}

Again, this is just the beginning. We rolled out this support in our recent 4.1 update and we’re already seeing quite a bit of interest and requests, all which we’re pouring over as you read this. If you have a good idea we’d love to hear it, though, so definitely get in touch so we can chat.

Update

The fine folks behind Riposte open sourced their implementation of 1Password support. You can grab it on GitHub and fork it if you like. You could even spoon it if that’s your thing. We won’t judge.

2 replies

Trackbacks & Pingbacks

  1. [...] recently added support for URL schemes for developers and enterprising users to 1Password for iOS, and developers are all over it. [...]

  2. [...] Date: 01/25/2013 Webmaster Developers: Here's how to add a little 1Password to your iOS apps. Posted on Jan … They're two great tastes that taste even better together, thanks to some of the URL schemes we added to 1Password 4.1 for iOS. Here's how …. Read more about Developers: Here's how to add a little 1Password to your iOS apps … here: Developers: Here's how to add a little 1Password to your iOS apps … [...]

Comments are closed.