# Setup & Authentication

## Compatibility&#x20;

We are always working to enhance our existing UIKit. As a result, the minimum compatibility may vary for our previous version releases. Below is the compatibility list for our latest release. For a complete compatibility history of any given UIKit version, you may refer to our [changelogs](https://docs.social.plus/~/changes/5GVz91dkzloMulIORPZq/amity-uikit/changelogs/changelog-1).

* Amity-Social-Cloud-SDK - 5.14.0&#x20;
* Glide - 4.12.0&#x20;
* OKHTTP3 - 4.9.0&#x20;
* Retrofit2 - 2.50&#x20;
* Android Paging Data Library - 3.0.1&#x20;
* Room - 2.4.0-alpha04
* RxJava2 - 2.3.10&#x20;
* Gson - 2.8.10&#x20;
* Kotlin-std-lib - 1.5.10&#x20;
* Kotlin-coroutines - 1.5.0&#x20;
* Exo Player - 2.12.1
* HiveMQ mqtt client - 1.2.2

## Initialize the SDK

Before using the SDK, you need to initialize the SDK with your API key. Please find your account API key in [Amity Social Cloud Console.](https://portal.amity.co/login)&#x20;

After logging in Console:

1. Click **Settings** to expand the menu.
2. Select **Security**.
3. In the **Security** page, you can find the API key in the **Keys** section.

![API key in Security page](https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX0mOAVWkotGme0iRzu%2Fuploads%2FHByfbC7jAPzokdKTvOz4%2Fapikey.png?alt=media\&token=305f0efa-d526-421a-bc84-aba4b0a1ae8b)

```java
class SimpleApp : Application() {

    override fun onCreate() {
        super.onCreate()

        AmityCoreClient.setup(
            apiKey = "apiKey", 
            httpEndpoint = AmityRegionalEndpoint.EU,  // optional param, defaulted as SG region 
            socketEndpoint = AmityRegionalEndpoint.EU // optional param, defaulted as SG region 
        )
    }
}
```

#### Specify Endpoints Manually (Optional)

You can specify endpoints manually via optional parameters. API endpoints for each data center are different so you need to adjust the endpoint accordingly.&#x20;

We currently support multi-data center capabilities for the following regions:

|     Region    |         Endpoint         |   Endpoint URL  |
| :-----------: | :----------------------: | :-------------: |
|     Europe    | AmityRegionalEndpoint.EU | api.eu.amity.co |
|   Singapore   | AmityRegionalEndpoint.SG | api.sg.amity.co |
| United States | AmityRegionalEndpoint.US | api.us.amity.co |

## Authentication

You must first register the current device with a `userId`. A device registered with a `userId` will be permanently tied to that `userId` until you deliberately unregister the device, or until the device has been inactive for more than 90 days. A device registered with a specific `userId` will receive all messages belonging to that user.

{% embed url="<https://gist.github.com/amythee/b6d53829e0295df991381bdccf13e317#file-amityauthentication-kt>" %}
