> 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-docs/user-guide/smart-auth.md).

# Smart Auth (identity)

## **Goal**

The main goal of the Smart Auth SDK is to prove that a user is really who he says he is. The SDK works as a form of multi-factor authentication for registered identities.

## **How it works**

How the Smart Auth SDK works can be seen in the flow chart below:

```mermaid
flowchart TB
    A(<b>Requests user authentication <br> via a policy) 
    B{<b>Is the <br> user's context <br> known?}
    C(<b>Performs all <br> re-authentication steps)
    E(<b>Returns an attestation <br> that the user is truthful)
    D{<b>Have they <br> all been <br> approved}
    F(<b>Returns that user <br> authentication failed)
    G(<b>Sends attestation to your <br> server for verification)
    H(<b>Rejects user request)
    I{<b>Have they <br> all been <br> approved?} 
    J(<b>Aproves the user <br> request)

    A --> B
    B --> |Yes| E
    B --> |No| C
    C --> D
    D --> |Yes| E
    D --> |No| F
    E --> G
    F --> H
    G --> I
    I --> |Yes| J
    I --> |No| H

    style A color: #000,fill:#80EABE,stroke:#000,stroke-width:1px
    style B color: #FFFFFF,fill:#3A76CF,stroke:#000,stroke-width:1px
    style C color: #FFFFFF,fill:#3A76CF,stroke:#000,stroke-width:1px
    style D color: #FFFFFF,fill:#3A76CF,stroke:#000,stroke-width:1px
    style E color: #FFFFFF,fill:#3A76CF,stroke:#000,stroke-width:1px
    style F color: #FFFFFF,fill:#3A76CF,stroke:#000,stroke-width:1px
    style G color: #FFFFFF,fill:#3A76CF,stroke:#000,stroke-width:1px
    style H color: #000,fill:#80EABE,stroke:#000,stroke-width:1px
    style I color: #000,fill:#ff999999,stroke:#000,stroke-width:1px
    style J color: #000,fill:#80EABE,stroke:#000,stroke-width:1px
```

Briefly:

1. During some routine of your application or website (such as login, password changes, or bank transfers) a call will be made to the SDK with the ID of the policy to be verified and the PersonId of the user.
2. We will receive the request and, according to policy, determine if the user context is known.
   1. If it is, the SDK jumps to item 3.
   2. If not, the user will go through all the means of authentication required by the policy (e.g. facial authentication, via SMS, etc.).
      1. If all are correct, the SDK jumps to item 3.
      2. If either one fails, the SDK jumps to item 4.
3. The SDK returns a signed JWT using your `clientSecret` attesting that the user is who they say they are.
   1. You send this JWT to your API and check the details and the signature.
      1. If something is incorrect, the user is not authenticated
      2. If everything is correct, the user is authenticated and cleared to perform the desired operation.
   2. End of execution
4. The SDK returns that the user is not authorized.
   1. End of execution

## **Useful resources**

* [Starting the Integration with the Smart Auth SDK](/caf-docs/user-guide/smart-auth/getting-started.md)
* [Checking the response on your server](/caf-docs/user-guide/smart-auth/checking-the-response.md)
* [Rules Catalog](/caf-docs/user-guide/smart-auth/catalog-rules.md)

And these are the versions of the Smart Auth SDK that are publicly available today:

* [SDK Android](https://docs.caf.io/caf-sdk/android/cafsmartauth) (Android)
* [SDK iOS](https://docs.caf.io/caf-sdk/ios/cafsmartauth) (iOS)
* [SDK React Native](https://docs.caf.io/caf-sdk/react-native/cafsmartauth/getting-started) (React Native)
* [SDK Web](https://docs.caf.io/caf-sdk/web-javascript/getting-started/smartauth) (JavaScript)


---

# 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-docs/user-guide/smart-auth.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.
