# C-Sharp \[C#\] Websocket Authorization Error (accessTokenRequest)

**URL:** <https://community.tradovate.com/t/c-sharp-c-websocket-authorization-error-accesstokenrequest/4735>\
**Category:** API Developers\
**Created:** [May 27, 2022, 6:43pm UTC](https://community.tradovate.com/t/c-sharp-c-websocket-authorization-error-accesstokenrequest/4735 "2022-05-27T18:43:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alonsat](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@alonsat](https://community.tradovate.com/u/alonsat)\
**Post date:** [May 27, 2022, 6:43pm UTC](https://community.tradovate.com/t/c-sharp-c-websocket-authorization-error-accesstokenrequest/4735/1 "2022-05-27T18:43:49Z")

</div>

Hello, I try this:

→ On wss://live.tradovateapi.com/v1/websocket

```
        string endpoint = "auth/accessTokenRequest";
        var id = Interlocked.Increment(ref RequestCounter);
        string queryParams = "";

        string body = "{\"name\":\"" + name_ + "\",";
        body = body + "\"password\":\"" + password_ + "\",";
        body = body + "\"appId\":\"" + appId_ + "\",";
        body = body + "\"appVersion\":\"" + appVersion_ + "\",";
        body = body + "\"deviceId\":\"" + deviceId_ + "\",";
        body = body + "\"cid\":\"" + cid_ + "\",";
        body = body + "\"sec\":\"" + sec + "\"}";

        var frame = $"{endpoint}\n{id}\n{queryParams}\n{body}";

        websocket.Send(frame);

```

But I receive an immediately **Code:** 1000 **Reason:** Bye

Do you know, what happens here? Thanks!

---

<div class="post-metadata">

**Author:** ![alonsat](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@alonsat](https://community.tradovate.com/u/alonsat)\
**Post date:** [May 27, 2022, 7:23pm UTC](https://community.tradovate.com/t/c-sharp-c-websocket-authorization-error-accesstokenrequest/4735/2 "2022-05-27T19:23:33Z")

</div>

Ok, I have the answer now from FAQ in Github.

**AUTHENTICATION is only in REST API’s in auth/accessTokenRequest**

 ![Capture](https://us1.discourse-cdn.com/flex015/uploads/tradingforum/original/2X/f/f1e1e99b8d3a691bff6a71d96f4671623cda7f40.jpeg)

---

<div class="post-metadata">

**Author:** ![alonsat](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@alonsat](https://community.tradovate.com/u/alonsat)\
**Post date:** [May 27, 2022, 8:05pm UTC](https://community.tradovate.com/t/c-sharp-c-websocket-authorization-error-accesstokenrequest/4735/4 "2022-05-27T20:05:41Z")

</div>

Hi @son_hoang ! Thanks for the response! And yes, I use C# and yes, I use a websocket in C#.

The problem is that **is impossible** to obtain in Websocket (See FAQ Reply), only in REST API. ([https://demo.tradovateapi.com/v1/auth/accessTokenRequest](https://demo.tradovateapi.com/v1/auth/accessTokenRequest) || [https://live.tradovateapi.com/v1/](https://live.tradovateapi.com/v1/)). I’m able now to obtain via REST API, when I finish I will upload the code for the Community.

And I don’t know if this Community is or not Horrible but I want to contribute to be better. Good luck!
