> For the complete documentation index, see [llms.txt](https://catchdocs.gitbook.io/catch-customer-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://catchdocs.gitbook.io/catch-customer-documentation/interactivity-catch/add-catch-to-another-app/authentication.md).

# Authentication

When `CatchLite` is integrated into a 3rd party Host App, the Host App must initialise the `CatchLite` Library with a user authentication token. This token, acquired from the Catch API via the integrator's own cloud endpoint, represents a unique user within the Catch system that is mapped to a corresponding user within the integrator's system via unique string identifier. This identifier may be chosen by the integrator, is permanent, and should be maintained by the integrator for subsequent requests scoped to the same host user.

<figure><img src="https://2966176008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIFiiJXfTguvp4qi7HGaq%2Fuploads%2FF0RJWdUsr9RslgX9NYfo%2FScreenshot%202024-03-08%20at%2015.34.53.png?alt=media&amp;token=11de056b-0c78-44b8-a536-2f85d6be803d" alt="" width="375"><figcaption></figcaption></figure>

## Request

<mark style="color:green;">`POST`</mark> `https://api.catchapi.com/api/integrator/users/v1/request_auth_token`

```
Authorization: Bearer <api-key>
```

|         |                                                                                 |
| ------- | ------------------------------------------------------------------------------- |
| api-key | Catch API key. This will be issued and shared as part of integrator onboarding. |

### Request Body

```
{
  "user": {
    "identity": <string>
  }
}
```

| Name     | Value      | Notes                                                                                                                                                                                                            |
| -------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| identity | `<string>` | <p>Identifier uniquely identifying a user in the integrator's system.</p><p></p><p>This could be a sequentially allocated numeric identifier, or a UUID. It is recommended that the identifier be anonymous.</p> |

### **Response**

```json
{
  "user": {
    "identity": <string>,
    "is_new": <bool>,
  },
  "auth_token": {
    "token": <string>,
    "expires_at": <datetime>
  }
}
```

| Status Code | Meaning                           |
| ----------- | --------------------------------- |
| 200         | Success, User is an existing user |
| 201         | Success, User is a new user       |

## Initialising the library

The `token` provided in the authntication respose should then be used to initialise the library.
