# Authorization error

**URL:** <https://forum.social.plus/t/authorization-error/630>\
**Category:** Web\
**Created:** [January 25, 2023, 3:10pm UTC](https://forum.social.plus/t/authorization-error/630 "2023-01-25T15:10:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tech](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tech](https://forum.social.plus/u/Tech)\
**Post date:** [January 25, 2023, 3:10pm UTC](https://forum.social.plus/t/authorization-error/630/1 "2023-01-25T15:10:35Z")

</div>

Hi,

I am new to the Amity APIs and I am using `@amityco/ts-sdk` to develop social features in my ReactNative application.

I have a problem with fetching community posts.

This error sometime (Not Always) returns when I want to fetch:

```auto
{"error": [Error: Amity SDK (400100): Authorization info not found], "loading": false, "origin": "server"}

```

I am calling `await connectClient({userId, displayName});` every time that user opens the app.  
Also I can get user’s data by `liveUser` but I don’t know why I am getting the authorization error when I want to fetch community posts.

---

<div class="post-metadata">

**Author:** ![aungmoehein](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@aungmoehein](https://forum.social.plus/u/aungmoehein)\
**Post date:** [January 26, 2023, 4:42am UTC](https://forum.social.plus/t/authorization-error/630/2 "2023-01-26T04:42:47Z")

</div>

Hi Tech, before you call `await connectClient({userId, displayName});`, you need to initialize this code to setup **AmityClient** first.

```auto
import { API_REGIONS, createClient, enableCache } from '@amityco/ts-sdk';

const apiKey = 'YOUR_API_KEY';

const client = createClient(apiKey, API_REGIONS.EU);

enableCache();

```

For more information, you can check this link from AmityDoc [https://docs.amity.co/installation#initialization](https://docs.amity.co/installation#initialization)

---

<div class="post-metadata">

**Author:** ![Tech](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tech](https://forum.social.plus/u/Tech)\
**Post date:** [January 28, 2023, 10:27am UTC](https://forum.social.plus/t/authorization-error/630/3 "2023-01-28T10:27:46Z")

</div>

Thank you @aungmoehein for the response.

I have a function called `connectToAmity`:

```auto
export const connectToAmity = () => {
  createClient(valueConstant.amity.apiKey, API_REGIONS.US);
  enableCache();
};

```

I call this function in the very beginning screen of my app.

If you reread my first post, I mentioned that I can fetch community posts sometimes. It means I implemented it in the correct way.

---

<div class="post-metadata">

**Author:** ![aungmoehein](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@aungmoehein](https://forum.social.plus/u/aungmoehein)\
**Post date:** [January 30, 2023, 7:01am UTC](https://forum.social.plus/t/authorization-error/630/4 "2023-01-30T07:01:57Z")

</div>

Hi. @Tech , did you happen to store the **client** object after creating the client? Can you show me the client object? There should be **userId** and **connected** status to ensure the authorization. Thank you.
