# 401 error when not using demo

**URL:** <https://community.tradovate.com/t/401-error-when-not-using-demo/4134>\
**Category:** Community Support\
**Created:** [March 7, 2022, 3:52pm UTC](https://community.tradovate.com/t/401-error-when-not-using-demo/4134 "2022-03-07T15:52:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![beebee](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/beebee/32/1776_2.png) [@beebee](https://community.tradovate.com/u/beebee)\
**Post date:** [March 7, 2022, 3:52pm UTC](https://community.tradovate.com/t/401-error-when-not-using-demo/4134/1 "2022-03-07T15:52:51Z")

</div>

When I use the demo credentials and demo websocket endpoints, the orders work just fine. Changing to the name and userId returned from the api request, I can authorize but sending orders return a 401 error.

Any assistance with this?

The only difference is that I change from my demo credentials and I also use the below websocket endpoints.

```auto

'api_wss': 'wss://live.tradovateapi.com/v1/websocket', 
'md_wss': 'wss://md.tradovateapi.com/v1/websocket',

```

---

<div class="post-metadata">

**Author:** ![beebee](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/beebee/32/1776_2.png) [@beebee](https://community.tradovate.com/u/beebee)\
**Post date:** [March 7, 2022, 4:44pm UTC](https://community.tradovate.com/t/401-error-when-not-using-demo/4134/2 "2022-03-07T16:44:16Z")

</div>

Seems like the entire system is down… Nope, just the live environment…

---

<div class="post-metadata">

**Author:** ![Alexander](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/alexander/32/988_2.png) [@Alexander](https://community.tradovate.com/u/Alexander)\
**Post date:** [March 7, 2022, 6:47pm UTC](https://community.tradovate.com/t/401-error-when-not-using-demo/4134/3 "2022-03-07T18:47:38Z")

</div>

Can you share a full log of the error please?

---

<div class="post-metadata">

**Author:** ![beebee](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/beebee/32/1776_2.png) [@beebee](https://community.tradovate.com/u/beebee)\
**Post date:** [March 7, 2022, 7:09pm UTC](https://community.tradovate.com/t/401-error-when-not-using-demo/4134/4 "2022-03-07T19:09:41Z")

</div>

There was no log per se. I could bring up the websockets and authorize with 200 response but after that all other api called failed.

It seems like there were some technical difficulties earlier because all the live platforms were down for me but now they are back up.

---

<div class="post-metadata">

**Author:** ![Alexander](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/alexander/32/988_2.png) [@Alexander](https://community.tradovate.com/u/Alexander)\
**Post date:** [March 8, 2022, 1:12pm UTC](https://community.tradovate.com/t/401-error-when-not-using-demo/4134/5 "2022-03-08T13:12:26Z")

</div>

Hey @beebee, is this still an issue or did the problem resolve when the platform came back up for you?

---

<div class="post-metadata">

**Author:** ![beebee](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/beebee/32/1776_2.png) [@beebee](https://community.tradovate.com/u/beebee)\
**Post date:** [March 8, 2022, 1:20pm UTC](https://community.tradovate.com/t/401-error-when-not-using-demo/4134/6 "2022-03-08T13:20:41Z")

</div>

The issue went away. I think I spend way too many hours connected to your servers because I can often tell when you guys go down for maintenance.

---

<div class="post-metadata">

**Author:** ![Alexander](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/alexander/32/988_2.png) [@Alexander](https://community.tradovate.com/u/Alexander)\
**Post date:** [March 8, 2022, 2:13pm UTC](https://community.tradovate.com/t/401-error-when-not-using-demo/4134/7 "2022-03-08T14:13:15Z")

</div>

That’s possible. Make sure you always are using a valid token. Check the local time against the token’s expiry periodically and call out to `auth/renewAccessToken` when it’s close - the token renewal endpoint requires a valid token. Also make sure you have a ‘reconnect’ or connection-lost’ type of procedure set up for unexpected WebSocket closure.
