Getting Started
Requirements
The minimal iOS version of an application using the ReachFive iOS SDKs has to be 13
.
To initialize the ReachFive client:
-
You need a Domain URL and Client ID.
-
You must whitelist all available domains where the ReachFive SDK will be used.
This is done in the Allowed Origins (CORS) field of your ReachFive console, in the Settings menu.
iOS specific prerequisites
-
The client must be a
First-party client
withToken Endpoint Authentication Method
set toNone
. -
You must have the scheme registered in
Allowed Callback URLs
. -
You should enforce PKCE for security purposes and enable Refresh Tokens for convenience.
For more on configuring a client, see Set up a client.
Installation
ReachFive SDKs are published on Cocoapods as independent modules. The latest version is 5.8.0
.
You can also find releases directly on the ReachFive repo at ReachFive iOS SDK. |
Below, you’ll find a description and instructions for installation for each module. |
SDK Core
The core SDK contains all the main tools and interfaces, and methods related to standard authentication by identifier and password. It contains all common tools and interfaces and enables users to authenticate with their passwords.
-
Add these lines to your
Podfile
file, replacingx.y.z
with the latest version:pod 'IdentitySdkCore', '~> x.y.z'
-
Then run:
pod install
SDK Webview
The SDK Webview module uses a web page in Safari to authenticate users. It enables all providers that are configured in your ReachFive account.

-
Add these lines to your
Podfile
file, replacingx.y.z
with the latest version:pod 'IdentitySdkWebView', '~> x.y.z'
-
Then run:
pod install
For mobile contexts, you must whitelist
reachfive-${clientId}://callback
, using your ReachFive Identity Client ID.This URL scheme is the default callback URL and is used to request a token when implementing the SDK Webview.
-
Configure your application’s
Info.plist
file with the following XML snippet:<!-- Info.plist --> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string>reachfive-${clientId}</string> </array> </dict> </array>
Facebook native provider
This module uses the Facebook native SDK to provide a better user experience.
Refer to the Meta Connect (Facebook Login) guide to create your Facebook application. |
-
Add these lines to your
Podfile
file, replacingx.y.z
with the latest version:pod 'IdentitySdkFacebook', '~> x.y.z'
-
Then run:
pod install
If you’re using the latest version of the Facebook API, please remove the user_gender
scope from the ReachFive client configuration to prevent any issues. -
Configure the
Info.plist
file with the following XML snippet that contains data about your application:<!-- Info.plist --> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>fb$(YOUR_FACEBOOK_APPLICATION_ID)</string> </array> </dict> </array> <key>FacebookAppID</key> <string>$(YOUR_FACEBOOK_APPLICATION_ID)</string> <key>FacebookDisplayName</key> <string>$(YOUR_APPLICATION_NAME)</string>
-
Then to use any of the Facebook dialogs (e.g., Login, Share, App Invites, etc.) that can perform an app switch to Facebook apps, include the following lines:
<!-- Info.plist --> <key>LSApplicationQueriesSchemes</key> <array> <string>fbapi</string> <string>fb-messenger-share-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array>
See Info.plist reference for a comprehensive look a the file. |
Google native provider
This module uses the Google native SDK to provide a better user experience.
Refer to the Google Connect guide to create your Google application. |
-
Add these lines to your
Podfile
file, replacingx.y.z
with the latest version:pod 'IdentitySdkGoogle', '~> x.y.z'
-
Then run:
pod install
-
Update your
Info.plist
file.-
Add your Google Client ID to the
Info.plist
file:... <key>GIDClientID</key> <string>GOOGLE_CLIENT_ID</string> (1) ...
1 This is your Google Client ID in standard format. For example, 1234567890-abcdefg.apps.googleusercontent.com
.See Info.plist reference for a comprehensive look a the file. -
Add your reversed Google Client ID to the URL Scheme.
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string>YOUR_REVERSED_GOOGLE_CLIENT_ID</string> (1) </array> </dict> </array>
1 The URL Scheme is the reversed Google Client ID (not ReachFive’s clientID), which is your Google Client ID with the order of the dot-delimited fields reversed. For example, com.googleusercontent.apps.abcdefg-1234567890
.See Info.plist reference for a comprehensive look a the file.
-
Add your reversed Google Client ID to the URL Scheme.
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string>YOUR_REVERSED_GOOGLE_CLIENT_ID</string> (1) </array> </dict> </array>
1 The URL Scheme is the reversed Google Client ID (not ReachFive’s clientID), which is your Google Client ID with the order of the dot-delimited fields reversed. For example, com.googleusercontent.apps.abcdefg-1234567890
.See Info.plist reference for a comprehensive look a the file.
-
Initialization
import UIKit
import IdentitySdkCore
import IdentitySdkFacebook
import IdentitySdkWebView
import IdentitySdkGoogle
class AppDelegate: UIResponder, UIApplicationDelegate {
let DOMAIN = "Here paste your ReachFive domain" // e.g. integ-sandbox-squad2.reach5.dev
let CLIENT_ID = "Here paste your ReachFive client ID" // e.g. zhU43aRKZtzps551nvOM
let reachfive = ReachFive(
// The configuration parameters required to initialize the ReachFive client
sdkConfig: SdkConfig(domain: DOMAIN, clientId: CLIENT_ID),
// The list of the social providers needed by the application
providersCreators: [GoogleProvider(), FacebookProvider(), WebViewProvider()]
)
// Return the ReachFive client
static func reachfive() -> ReachFive {
let app = UIApplication.shared.delegate as! AppDelegate
return app.reachfive
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return reachfive.application(app, open: url, options: options)
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
reachfive.addPasswordlessCallback { result in
// Add the callback that will be executed when the magic link is intercepted
}
// Initialize the ReachFive client
return reachfive.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
By default, the URL scheme follows this pattern: reachfive-${clientId}://callback
.
You can also specify one manually like this:
sdkConfig: SdkConfig(domain: DOMAIN, clientId: CLIENT_ID, scheme: SCHEME)
iOS methods
The sidebar contains are all the functions/methods accessible via the iOS SDK.
In all the code examples below, the ReachFive client is instantiated and stored in your AppDelegate
class. You can access it through the AppDelegate.reachfive()
method.
Info.plist reference
If you configure all four SDKs, your Info.plist
file should contain the following XML
Snippet.
This snippet represents what is needed for the latest iOS SDK version which is currently 5.8.0 .
|
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1634029666893228</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.abcdefg-1234567890</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tyaihfrj2a1fgj1t8pkd</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>reachfive-TYAIHFRJ2a1FGJ1T8pKD</string>
</array>
</dict>
</array>
<key>GIDClientID</key>
<string>1234567890-abcdefg.apps.googleusercontent.com</string>
<key>FacebookAppID</key>
<string>1634029666893228</string>
<key>FacebookDisplayName</key>
<string>Reach5 SDK Mobile</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1634029666893228</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.abcdefg-1234567890</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tyaihfrj2a1fgj1t8pkd</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>reachfive-TYAIHFRJ2a1FGJ1T8pKD</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>1634029666893228</string>
<key>FacebookDisplayName</key>
<string>Reach5 SDK Mobile</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>