> For the complete documentation index, see [llms.txt](https://docs.caf.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.caf.io/caf-sdk/react-native/standalone-modules/cafsmartauth/getting-started.md).

# Getting started

All integration will be based on files already present in the [sample repository](https://github.com/combateafraude/identity-reactnative-sdk).

{% hint style="warning" %}
For security reasons, our repository is private, if you want to perform the integration with the product, please contact the person responsible for your service.
{% endhint %}

## Android

1. Copy the files **`CombateAFraudeModule.java`** and **`CombateAFraudePackage.java`**, located in the example repository in the path `SDKsExample/android/app/src/main/java/com/sdksexample/` \*\*\*\* to the folder \*\*\*\* `<root-project>/android/app/src/main/java/com/<your-package-name>` in your project.

> Note: the function **`getName`** will be used to call the method on the React Native side; The method annotated with @ReactMethod will be used for the calls on the React Native side.

2\. Reference the module in your **`MainApplication.java`**

```java
import com.<your-package-name>;

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    ...
    packages.add(new CombateAFraudePackage());
    ...
}
```

3\. In the `<root-project>/android/build.gradle` file add our Maven repository and the **`minSdkVersion`** setting for at least API 21:

```groovy
buildscript {
    ext {
        minSdkVersion = 21
    }
}

allprojects {
    repositories {
        maven { url "https://repo.combateafraude.com/android/release" }
    }
}
```

4\. In the `<root-project>/android/app/build.gradle` file add our project settings:

```groovy
android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    aaptOptions {
        noCompress "tflite"
    }

    dataBinding {
        enabled = true
    }
}
```

5\. In the same file, add the Identity dependencies:

```groovy
dependencies {
    implementation 'com.combateafraude.sdk:identity:<sdk_version>'
}
```

6\. Update the dependencies by running the following commands:

```bash
cd android
./gradlew clean bundleRelease
./gradlew build --refresh-dependencies
```

> **Note:** Check that you are running Java version 1.8. If not, run it:

```bash
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
```

### iOS

1. In the **`<root-project>/ios/Podfile`**, make sure the minimum iOS version is 12.4+, add the line **`use_frameworks!`** and disable Flipper:

```swift
platform :ios, '12.4'
use_frameworks!

target '<app-name>' do
 ...
 # Note that if you have use_frameworks! enabled, Flipper will not work and
 # you should disable these next few lines.
 # use_flipper!
 # post_install do |installer|
 #   flipper_post_install(installer)
 # end
end

target '<app-name>-tvOS' do
 ...
end

source 'https://github.com/combateafraude/iOS.git'
source 'https://cdn.cocoapods.org/'
```

2\. In the same file, add the iOS SDKs you want to use:

```swift
target '<app-name>' do
 pod 'Identity', '~> <version>'
end
```

3\. Run the command **`cd ios && pod install && cd ..`** to install the dependencies

4\. Copy the **`SDKsExample-Bridging-Header.h`**, **`CombateAFraude.m`** and **`CombateAFraude.swift`** files, located in the repository in the \*\*`SDKsExample/ios` \*\* path, to the **`<root-project>/ios`** folder

5\. In case you have any issues running the project after completing all the steps, add this code line in your Podfile and run the command **`cd ios && pod install && cd ..`**

```ruby
post_install do |installer|
  fix_deployment_target(installer)
  enable_bitcode(installer)
end

# This resolves any possible deployment issue by making sure it is the same as the project
def fix_deployment_target(installer)
  return if !installer
  project = installer.pods_project
  project_deployment_target = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']

  puts "Make sure all pods deployment target is #{project_deployment_target.green}"
  project.targets.each do |target|
    puts "  #{target.name}".blue
    target.build_configurations.each do |config|
      old_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
      new_target = project_deployment_target
      next if old_target == new_target
      puts "    #{config.name}: #{old_target.yellow} -> #{new_target.green}"
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = new_target
    end
  end
end

def enable_bitcode(installer)
  return if !installer
  installer.pods_project.build_configurations.each do |config|
    # config.build_settings['ENABLE_BITCODE'] = 'YES'
    # config.build_settings['OTHER_CFLAGS'] = '-fembed-bitcode'
    # config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
    config.build_settings['DEAD_CODE_STRIPPING'] = 'YES'
    config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
  end
end

```

### Calling the application codes

The **`App.js`** file in the example repository shows how to call these methods and access their results.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.caf.io/caf-sdk/react-native/standalone-modules/cafsmartauth/getting-started.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
