Argyle’s iOS Link SDK provides a way to integrate Link into your iOS app.
First-time installation instructions are below. To update versions, visit our upgrade guide.
Requirements:
- iOS 14.0+
- Xcode 14.0+
- Swift 5.5+
…using CocoaPods:
- In the
Podfile
of your Xcode project, addpod 'Argyle', '5.12.0'
(example Podfile) - Run
pod install
to install the Argyle pod - Run
pod update
to ensure the most recent Argyle pod is installed
…using Swift Package Manager:
- Within your Xcode project, select File > Swift Packages > Add Package Dependency
- Find
argyle-link-ios
by searching the URL of this repo
See adding Swift package dependencies in Xcode for more information.
To enhance the multi-factor authentication (MFA) experience of users, the Link SDK supports directly opening the user’s email client. To enable this feature…
- Add the following property to your
Info.plist
file:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>googlegmail</string>
<string>ymail</string>
<string>ms-outlook</string>
</array>
- Log-in to Console and retrieve a copy of your Link key
- Create a user token:
- New users
- Create a new user by sending a POST to the users endpoint of the Argyle API
- The response payload will include an
id
anduser_token
- Save the
id
for quickly creating user tokens for this user in the future - Initialize Link by passing the
user_token
as the value for theuserToken
parameter
- Returning users
- Send a POST request to the user-tokens endpoint of the Argyle API
- Include the
id
of the user in the request body as a JSON object in the format{"user": "<id>"}
- Include the
- A
user_token
will be included in the response payload - Initialize Link by passing the
user_token
as the value for theuserToken
parameter
- Send a POST request to the user-tokens endpoint of the Argyle API
- Initialize Link using the Link key and user token.
Example Link initialization for iOS:
var config = LinkConfig(
linkKey: "YOUR_LINK_KEY",
userToken: "USER_TOKEN",
sandbox: true // Set to false for production environment.
)
// (Optional) Limit Link search to these Items:
config.items = ["item_000001422", "item_000025742"]
// (Optional) Callback examples:
config.onAccountConnected = { data in
print("Result: onAccountConnected \(data)")
}
config.onAccountError = { data in
print("Result: onAccountError \(data)")
}
config.onDDSSuccess = { data in
print("Result: onDDSSuccess \(data)")
}
config.onDDSError = { data in
print("Result: onDDSError \(data)")
}
config.onTokenExpired = { handler in
print("onTokenExpired")
// generate your new token here
// handler(newToken)
}
ArgyleLink.start(from: viewController, config: config)