Configuring an iOS App as an Identity Provider Client

You can configure any app built on Mobile SDK 11.0 or later as an identity provider client. You configure it to identify itself as an identity provider client and to specify its identity provider. Mobile SDK does the rest.

  1. In the init() method of your AppDelegate class, specify the URI scheme for the identity provider you’re using:

    Swift

    Objective-C

  2. In your app's info.plist file, add the URI scheme defined in your identity provider clients’ connected app:

  3. In your AppDelegate class implementation, find the following method and reinstate the commented code as follows:

    Swift

    Objective-C

Your app is now ready for use as an identity provider client.

After you set up your IDP app to initiate authentication, update the client to complete the flow. You can use these methods to handle the incoming IDP URL.

Swift

Objective-C

Mobile SDK provides template apps for both identity providers and their client apps. The client template defines a view that lets the user choose to log in through an identity provider or the Salesforce login screen. When a user opens an app built from the client template, the app presents this view if

  • the user hasn’t yet logged in, or
  • the current user hasn't been set.

To customize the login style selection view, a client app extends the UIViewController class and also must implement the SFSDKLoginFlowSelectionView protocol.

During the client app’s identity provider flow, Mobile SDK sets up an instance of the selectionFlowDelegate and appOptions properties defined in this protocol. You use these artifacts in your view controller to notify Mobile SDK of the user's login method selection. For example, assume that you’ve implemented the SFSDKUserSelectionView protocol in a UIViewController class named IDPLoginNavViewController. You then can use that view controller as the user selection dialog box by setting the idpLoginFlowSelectionAction on the SalesforceSDKManager shared instance, as follows: