- JUMP for Android
- JUMP for iOS
- Sample Applications
- Advanced Topics
- Legacy Engage for iOS
Before You Begin ¶
- You need to have created a Janrain Engage application.
- If you would like to do server-side authentication, you’ll need to create a token_url.
The current version of the library is 2.3.X, which includes support for Xcode 4 and iOS 5, an updated social sharing UI, the ability to dynamically exclude providers from list of sign-in providers or directly authenticate with one provider, better handling when your application quits or goes into the background, and several bug fixes.
User Experience ¶
Sign In ¶
The Janrain Engage for iPhone library gives your application the ability to authenticate users through their existing social Identity Provider accounts — Google, Facebook, Twitter, and so on. When you are ready to authenticate a user, the library presents a modal dialog displaying a list of the providers that you configured in your Engage application. The user can select his desired provider and sign in through the provider’s web interface. The library remembers his preference for a better return experience.
Below are some screen shots demonstrating the sign-in process on the iPhone.
For an example application demonstrating authentication with the Engage for iOS library, the Janrain Quick Sign-In* app is available for free from the AppStore.
Social Sharing ¶
Additionally, the Engage for iOS library includes a social sharing API, giving your users the ability to share their activities on several social networks. You can compose an activity, and when you are ready, the library presents a modal dialog that allows your users to add their comments and share the activity. They can post it to a number of social providers, as well as share it through email and SMS.
Below are some screen shots demonstrating social sharing on the iPhone.
For an example application demonstrating how you can share an activity with the Engage for iOS library, the Janrain Quick Publish* app is available for free from the AppStore.
On the iPad ¶
The Engage for iOS SDK also works, as is, on the iPad and with universal apps. No changes to your code are required. The library dynamically detects the device and presents its dialogs in modal views optimized for the iPad.
Below are some screen shots demonstrating sign-in and social sharing on the iPad.
* The Quick Sign-In and Quick Publish applications are free and the source code for both applications ship with the library.
The following components are the main actors that are required for social sign-in and sharing:
- An iPhone/iPad Application.*
- The Janrain Engage for iOS library.
- The Engage server (rpxnow.com).
- Sign-in and social sharing providers — Google, Facebook, Twitter, and so on.
- An optional web service* with an auth_info token URL.
* Samples come with library.
Sign-In Flow ¶
- Your iOS application requests that the Engage for iOS library present the sign-in dialog.
- The user chooses a provider.
- The library takes the user to the provider in an embedded web browser where she signs in.
- Janrain Engage completes authentication and sends the auth_info token, the user’s authentication information, and the user’s unique identifier back to the library.
- The library closes the dialog and passes the profile data to the calling application.
- Optionally, the library can post the auth_info token to a token URL to complete server-side authentication:
- If you would like to do server-side authentication, you’ll need to create a token URL. (See also, Janrain’s sample code.)
- The library opens an HTTP/S connection to the token URL, in which:
- The library POSTs the auth_info token to the token URL.
- Your token URL server POSTs to the Engage auth_info url with the supplied auth_info token and your Engage API key. You may also make additional calls against the Engage API.
- The Engage server will respond to your server with the user’s authentication information and the user’s unique identifier.
- Your token URL server then creates a session tied to the user’s identifier, and responds to the library with a session token.
- The response from your server’s token URL, containing the session token you created, is passed to your JREngageDelegate through the jrAuthenticationDidReachTokenUrl:withResponse:andPayload:forProvider: method.
- Your mobile application stores the session token supplied in the token URL’s response, and uses it to communicate securely with your web service — to conduct purchases, access user data, or perform other sensitive transactions.
- The application parses the profile data and the user is signed in.
Sharing Flow ¶
- The application creates an activity object and populates the object’s fields.
- The application initiates social sharing, passing the activity object to the library.
- The user can add comments and choose which provider he wishes to share the activity with.
- If the user is already signed in, he can post the activity to the provider.
- If the user is not signed in, the library takes the user to the provider’s web interface where he authenticates, and then the activity is shared.
- The user can share to multiple providers, and the dialog is closed when the user presses the “Close” button.