> ## Documentation Index
> Fetch the complete documentation index at: https://docs.argyle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mobile SDKs

> Embed Argyle Link with the iOS, Android, React Native, or Flutter SDKs.

Use a mobile SDK when Link should run inside your native or cross-platform mobile application. Argyle supports iOS, Android, React Native, and Flutter.

> [!NOTE]
>
> If you are not using a mobile SDK, prefer either a client-hosted Web SDK implementation in a secure webview, or [Hosted Link](https://docs.argyle.com/link/initialization/hosted-link.md) in a secure browser context such as `ASWebAuthenticationSession` or Android Custom Tabs.

> [!NOTE]
>
> User tokens and session links both expire after one hour. Create a fresh user token before initializing Link with `userToken`, or create a new session link for an active verification before initializing Link with `connectUrl`.

## iOS

Argyle's [iOS Link SDK](https://github.com/argyle-systems/argyle-link-ios) provides a way to integrate Link into your iOS app. First-time installation instructions are below. To update versions, visit our [iOS Link upgrade guide](https://docs.argyle.com/link/upgrade.md#ios).

### Requirements - iOS SDK

iOS 14.0+, Xcode 14.0+, Swift 5.5+

### Installing the iOS SDK

> [tab] CocoaPods
>
> **If using [CocoaPods](https://cocoapods.org/):**
>
> 1. In the `Podfile` of your Xcode project, add `pod 'Argyle', '<Version Number>'`
> 2. Run `pod install` to install the Argyle pod
> 3. Run `pod update` to ensure the most recent Argyle pod is installed

> [tab] Swift Package Manager
>
> **If using [Swift Package Manager](https://www.swift.org/package-manager/):**
>
> 1. Within your Xcode project, select **File > Swift Packages > Add Package Dependency**
> 2. Find `argyle-link-ios` by searching with URL of the [iOS SDK GitHub repo](https://github.com/argyle-systems/argyle-link-ios)
>
> See [adding Swift package dependencies in Xcode](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app#Add-a-package-dependency) for more information.

### Directly opening email clients

To enhance the multi-factor authentication (MFA) experience of users, the iOS Link SDK supports directly opening the user's email client.

To enable this feature, add the following property to your `Info.plist` file:

```text theme={}
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>googlegmail</string>
    <string>ymail</string>
    <string>ms-outlook</string>
</array>
```

### Initialize Link

> [tab] userToken
>
> Create a user token:
>
> * **New users**: create the user via [`POST /v2/users`](https://docs.argyle.com/api-reference/users/create-a-user) and use the returned `user_token`.
> * **Returning users**: create a new token via [`POST /v2/user-tokens`](https://docs.argyle.com/api-reference/user-tokens/create-a-user-token) and use the returned `user_token`.
>
> Initialize Link using the configuration below, replacing the user token.
>
> ```swift theme={}
> var config = LinkConfig(
>     userToken: "USER_TOKEN",
>     sandbox: true // Set to false for production environment.
> )
> // (Optional) Add a Link flow customization created in Console:
> //    config.flowId = "<ID of the Link flow>"
> // (Optional) Limit Link search to specific Items:
> //    config.items = ["item_000000001", "item_000000002"]
> // (Optional) Connect directly to an existing account:
> //    config.accountId = "<ID of the account>"
> // (Optional) Set a language. Options: EN, ES, RU, ZH
> //    config.language = .EN
> // (Optional) A few recommended callbacks:
> config.onAccountConnected = { data in
>     print("Result: onAccountConnected \(data)")
> }
> config.onAccountError = { data in
>     print("Result: onAccountError \(data)")
> }
> config.onTokenExpired = { handler in
>     print("onTokenExpired")
>     // Generate a new user token.
>     // handler(newToken)
> }
>
> ArgyleLink.start(from: viewController, config: config)
> // ArgyleLink.close()   // Manually close Link (typically the user closes Link).
> ```

> [tab] connectUrl
>
> 1. [Create a session](https://docs.argyle.com/api-reference/verifications/create-a-session.md) as part of a payroll verification workflow.
> 2. Copy the response `link`.
> 3. Pass that value as `connectUrl` in your Link initialization.
>
> ```swift theme={}
> var config = LinkConfig(
>     connectUrl: "SESSION_LINK"
> )
> // (Optional) A few recommended callbacks:
> config.onAccountConnected = { data in
>     print("Result: onAccountConnected \(data)")
> }
> config.onAccountError = { data in
>     print("Result: onAccountError \(data)")
> }
>
> ArgyleLink.start(from: viewController, config: config)
> // ArgyleLink.close()   // Manually close Link (typically the user closes Link).
> ```

## Android

Argyle's [Android Link SDK](https://github.com/argyle-systems/argyle-link-android) provides a way to integrate Link into your Android app. First-time installation instructions are below. To update versions, visit our [Android Link upgrade guide](https://docs.argyle.com/link/upgrade.md#android).

### Requirements - Android SDK

* Android 8.0 (minSdk/API level 26) and above
* compileSdk 34 and above

### Installing the Android SDK

1. Add the line below within the dependencies of your `build.gradle` [configuration file](https://developer.android.com/studio/build#top-level).
2. [Sync your Android project](https://developer.android.com/studio/build#sync-files) to import the build configuration changes.

```text theme={}
dependencies {
    implementation 'com.argyle:argyle-link-android:5.x.x'
}
```

> [accordion] If you are using tools like ProGuard to obfuscate your code...
>
> Make sure to exclude the Link SDK package `com.argyle.*`. For example, add the following line to the `proguard-rules.pro` file of your ProGuard configuration:
>
> ```text theme={}
> -keep class com.argyle. { *; }
> ```

### Initialize Link

> [tab] userToken
>
> Create a user token:
>
> * **New users**: create the user via [`POST /v2/users`](https://docs.argyle.com/api-reference/users/create-a-user) and use the returned `user_token`.
> * **Returning users**: create a new token via [`POST /v2/user-tokens`](https://docs.argyle.com/api-reference/user-tokens/create-a-user-token) and use the returned `user_token`.
>
> Initialize Link using the configuration below, replacing the user token.
>
> ```kotlin theme={}
> val config = LinkConfig(
>     userToken = "USER_TOKEN",
>     sandbox = true // Set to false for production environment.
> )
> // (Optional) Add a Link flow customization created in Console:
> //    config.flowId = "<ID of the Link flow>"
> // (Optional) Limit Link search to specific Items:
> //    config.items = listOf("item_000000001", "item_000000002")
> // (Optional) Connect directly to an existing account:
> //    config.accountId = "<ID of the account>"
> // (Optional) Set a language. Options: EN, ES, RU, ZH
> //    config.language = Language.EN
> // (Optional) A few recommended callbacks:
> config.onAccountConnected = { data ->
>     Log.d("Result", "onAccountConnected $data")
> }
> config.onAccountError = { data ->
>     Log.d("Result", "onAccountError $data")
> }
> config.onTokenExpired = { handler ->
>     // Generate a new user token.
>     // handler(newToken)
> }
>
> ArgyleLink.start(context, config)
> // ArgyleLink.close()   // Manually close Link (typically the user closes Link).
> ```

> [tab] connectUrl
>
> 1. [Create a session](https://docs.argyle.com/api-reference/verifications/create-a-session.md) as part of a payroll verification workflow.
> 2. Copy the response `link`.
> 3. Pass that value as `connectUrl` in your Link initialization.
>
> ```kotlin theme={}
> val config = LinkConfig(
>     connectUrl = "SESSION_LINK"
> )
> // (Optional) A few recommended callbacks:
> config.onAccountConnected = { data ->
>     Log.d("Result", "onAccountConnected $data")
> }
> config.onAccountError = { data ->
>     Log.d("Result", "onAccountError $data")
> }
>
> ArgyleLink.start(context, config)
> // ArgyleLink.close()   // Manually close Link (typically the user closes Link).
> ```

## React Native

Argyle's [React Native Link SDK](https://github.com/argyle-systems/argyle-link-react-native) provides a way to integrate Link into your React Native application. First-time installation instructions are below. To update versions, visit our [React Native Link upgrade guide](https://docs.argyle.com/link/upgrade.md#react-native).

### Requirements - React Native SDK

* React Native version 0.73.0 or higher
* *iOS-specific*: iOS 14.0+
* *Android-specific*:
  * Android 8.0 (minSdk/API level 26) and above
  * compileSdk 34 and above

> [tab] ProGuard-like tools
>
> > [accordion] If you are using tools like ProGuard to obfuscate your code...
> >
> > Make sure to exclude the Link SDK package `com.argyle.*`. For example, add the following line to the bottom of your ProGuard configuration:
> >
> > ```text theme={}
> > -keep class com.argyle. { *; }
> > ```

> [tab] okhttp3 runtime issues
>
> The Link SDK package currently has a dependency of `okhttp3:4.9.2`. If your dependencies use an older version (e.g. `okhttp3.3.xx`) they may need updating to a version that uses `okhttp3.4.x.x`.
>
> Alternatively, you can attempt to force the Link SDK dependency as follows:
>
> ```text theme={}
> configurations.all {
>     resolutionStrategy.force 'com.squareup.okhttp3:okhttp:4.9.x'
>     resolutionStrategy.force 'com.squareup.okhttp3:okhttp-urlconnection:4.9.x'
> }
> ```

### Installing the React Native SDK

1. Navigate to the directory for your React Native project.
2. Install the packages from your terminal:

> [tab] NPM
>
> ```text theme={}
> npm install @argyleio/argyle-plugin-react-native --save
> ```

> [tab] Yarn
>
> ```text theme={}
> yarn add @argyleio/argyle-plugin-react-native
> ```

After installation:

1. Run `cd ios` to navigate to the `ios` folder.
2. Run `pod install` to install the Argyle pod.
3. Run `pod update` to ensure the most recent Argyle pod is installed.

### Initialize Link

> [tab] userToken
>
> Create a user token:
>
> * **New users**: create the user via [`POST /v2/users`](https://docs.argyle.com/api-reference/users/create-a-user) and use the returned `user_token`.
> * **Returning users**: create a new token via [`POST /v2/user-tokens`](https://docs.argyle.com/api-reference/user-tokens/create-a-user-token) and use the returned `user_token`.
>
> Initialize Link using the configuration below, replacing the user token.
>
> ```js theme={}
> import { ArgyleLink } from '@argyleio/argyle-plugin-react-native';
>
> // ...
>
> const config = {
>   userToken: 'USER_TOKEN',
>   sandbox: true, // Set to false for production environment.
>   // (Optional) Add a Link flow customization created in Console:
>   //    flowId: '<ID of the Link flow>',
>   // (Optional) Limit Link search to specific Items:
>   //    items: ['item_000000001', 'item_000000002'],
>   // (Optional) Connect directly to an existing account:
>   //    accountId: '<ID of the account>',
>   // (Optional) Set a language. Options: EN, ES, RU, ZH
>   //    language: Language.EN,
>   // (Optional) Callback examples:
>   onAccountConnected: (payload) => console.log('onAccountConnected', payload),
>   onAccountError: (payload) => console.log('onAccountError', payload),
>   onTokenExpired: (updateToken) => {
>     console.log('onTokenExpired');
>     // Generate a new user token.
>     // updateToken(newToken)
>   },
> };
>
> ArgyleLink.start(config);
> // ArgyleLink.close()   // Manually close Link (typically the user closes Link).
> ```

> [tab] connectUrl
>
> 1. [Create a session](https://docs.argyle.com/api-reference/verifications/create-a-session.md) as part of a payroll verification workflow.
> 2. Copy the response `link`.
> 3. Pass that value as `connectUrl` in your Link initialization.
>
> ```js theme={}
> import { ArgyleLink } from '@argyleio/argyle-plugin-react-native';
>
> // ...
>
> const config = {
>   connectUrl: 'SESSION_LINK',
>   // (Optional) Callback examples:
>   onAccountConnected: (payload) => console.log('onAccountConnected', payload),
>   onAccountError: (payload) => console.log('onAccountError', payload),
> };
>
> ArgyleLink.start(config);
> // ArgyleLink.close()   // Manually close Link (typically the user closes Link).
> ```

## Flutter

Argyle's [Flutter SDK](https://github.com/argyle-systems/argyle-link-flutter) provides a way to integrate Link into your mobile applications. First-time installation instructions are below. To update versions, visit our [Flutter upgrade guide](https://docs.argyle.com/link/upgrade.md#flutter).

### Requirements - Flutter SDK

> [tab] Android
>
> * Android 8.0 (minSdk/API level 26) and above
> * compileSdk 34 and above
>
> Set the `minSdkVersion` in your `android/app/build.gradle` file to:
>
> ```text theme={}
> android {
>     defaultConfig {
>         minSdkVersion 26 // or greater
>     }
> }
> ```

> [tab] iOS
>
> * iOS 14.0+, Xcode 14.0+, Swift 5.5+

### Installing the Flutter SDK

Add `argyle_link_flutter` as a [dependency](https://docs.flutter.dev/development/packages-and-plugins/using-packages) in your `pubspec.yaml` file.

> [accordion] Example installation:
>
> Using Flutter, run the command:
>
> ```text theme={}
> $ flutter pub add argyle_link_flutter
> ```
>
> This will add a line to your `pubspec.yaml` file with the latest SDK version:
>
> ```text theme={}
> dependencies:
>   argyle_link_flutter: ^1.x.x
> ```
>
> You can now import the package into your Dart code using:
>
> ```text theme={}
> import 'package:argyle_link_flutter/argyle_link_flutter.dart';
> ```

### Initialize Link

> [tab] userToken
>
> Create a user token:
>
> * **New users**: create the user via [`POST /v2/users`](https://docs.argyle.com/api-reference/users/create-a-user) and use the returned `user_token`.
> * **Returning users**: create a new token via [`POST /v2/user-tokens`](https://docs.argyle.com/api-reference/user-tokens/create-a-user-token) and use the returned `user_token`.
>
> Initialize Link using the configuration below, replacing the user token.
>
> ```dart theme={}
> import 'package:argyle_link_flutter/link_config.dart';
> // (Required if using callbacks) Callback argument type definitions:
> import 'package:argyle_link_flutter/account_data.dart';
> import 'package:argyle_link_flutter/argyle_link.dart';
> import 'package:argyle_link_flutter/form_data.dart';
>
> // ...
>
> final config = LinkConfig(
>   userToken: 'USER_TOKEN',
>   sandbox: true, // Set to false for production environment.
>   // (Optional) Add a Link flow customization created in Console:
>   //    flowId: '<ID of the Link flow>',
>   // (Optional) Limit Link search to specific Items:
>   //    items: ['item_000000001', 'item_000000002'],
>   // (Optional) Connect directly to an existing account:
>   //    accountId: '<ID of the account>',
>   // (Optional) Set a language. Options: en, es, ru, zh
>   //    language: Language.en,
>   // (Optional) Callback examples:
>   onAccountConnected: (payload) => debugPrint('onAccountConnected'),
>   onAccountError: (payload) => debugPrint('onAccountError'),
>   onTokenExpired: (updateToken) {
>     debugPrint('onTokenExpired');
>     // Generate a new user token.
>     // updateToken(newToken);
>   },
> );
>
> ArgyleLink.start(config);
> // ArgyleLink.close()   // Manually close Link (typically the user closes Link).
> ```

> [tab] connectUrl
>
> 1. [Create a session](https://docs.argyle.com/api-reference/verifications/create-a-session.md) as part of a payroll verification workflow.
> 2. Copy the response `link`.
> 3. Pass that value as `connectUrl` in your Link initialization.
>
> ```dart theme={}
> import 'package:argyle_link_flutter/link_config.dart';
> // (Required if using callbacks) Callback argument type definitions:
> import 'package:argyle_link_flutter/account_data.dart';
> import 'package:argyle_link_flutter/argyle_link.dart';
> import 'package:argyle_link_flutter/form_data.dart';
>
> // ...
>
> final config = LinkConfig(
>   connectUrl: 'SESSION_LINK',
>   // (Optional) Callback examples:
>   onAccountConnected: (payload) => debugPrint('onAccountConnected'),
>   onAccountError: (payload) => debugPrint('onAccountError'),
> );
>
> ArgyleLink.start(config);
> // ArgyleLink.close()   // Manually close Link (typically the user closes Link).
> ```
