# LiveKit Cloud API returns 401 invalid token with official Node.js SDK

**URL:** <https://community.livekit.io/t/livekit-cloud-api-returns-401-invalid-token-with-official-node-js-sdk/2585>\
**Category:** Getting Started\
**Created:** [November 22, 2026, 6:10pm UTC](https://community.livekit.io/t/livekit-cloud-api-returns-401-invalid-token-with-official-node-js-sdk/2585 "2026-11-22T18:10:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xvii\_bad](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/xvii_bad/32/3144_2.png) [@xvii\_bad](https://community.livekit.io/u/xvii_bad)\
**Post date:** [November 22, 2026, 6:10pm UTC](https://community.livekit.io/t/livekit-cloud-api-returns-401-invalid-token-with-official-node-js-sdk/2585/1 "2026-11-22T18:10:57Z")

</div>

Hello LiveKit community,

I’m integrating LiveKit Cloud into my Node.js application, MISS PERFECT.

My project URL and API Key ID match the MISSPERFECT dashboard, but authentication consistently fails with:

`401 Unauthorized: invalid token`

I tested using:

- The official `livekit-server-sdk` npm package.

- `RoomServiceClient.listRooms()`.

- Credentials loaded directly from my backend `.env` file.

- A newly generated API key and secret.

My computer clock is correct, and the credentials contain no surrounding whitespace.

Could someone help me determine why LiveKit Cloud rejects the official SDK authentication?

Thank you!

---

<div class="post-metadata">

**Author:** ![darryncampbell](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/darryncampbell/32/20_2.png) [@darryncampbell](https://community.livekit.io/u/darryncampbell)\
**Post date:** [November 23, 2026, 12:06am UTC](https://community.livekit.io/t/livekit-cloud-api-returns-401-invalid-token-with-official-node-js-sdk/2585/2 "2026-11-23T00:06:55Z")

</div>

Hi,

We have a blog post that covers this:

> **[Troubleshooting 401 unauthorized and token errors](https://livekit.com/blog/token-troubleshooting)**
>
> How to diagnose and fix "401 Unauthorized", "invalid API key", and "token not valid yet" errors when connecting to LiveKit Cloud. Covers clock skew, environment mismatches, and expired tokens.

It sounds like you have gone through the obvious root causes, but can I suggest you have a coding agent go through the blog to double-check everything is OK.

The other thing would be to use this tool to debug your tokens: [JWT Inspector · Yepher](https://yepher.com/tools/jwt)

---

<div class="post-metadata">

**Author:** ![xvii\_bad](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/xvii_bad/32/3144_2.png) [@xvii\_bad](https://community.livekit.io/u/xvii_bad)\
**Post date:** [November 24, 2026, 6:42am UTC](https://community.livekit.io/t/livekit-cloud-api-returns-401-invalid-token-with-official-node-js-sdk/2585/3 "2026-11-24T06:42:30Z")

</div>

Update: I synchronized my Windows clock successfully using Windows Time Service and confirmed that it is now synchronized with `time.windows.com`.

I retested authentication using the official `livekit-server-sdk` after synchronization. The test still fails:

```auto
Unauthorized: invalid token
HTTP status: 401
Error code: undefined
Metadata: undefined

```

I also confirmed that:

- The API URL matches my MISSPERFECT project.

- The API Key ID matches the newly generated key.

- The API secret was copied when that same key was created.

- Credentials are loaded directly from the backend `.env` file.

- The official SDK fails independently of my application code.

Could LiveKit staff please verify whether my API key is active, correctly registered, and associated with the `missperfect-wkx5iwgk.livekit.cloud` domain?

I would appreciate a project-side authentication check before rotating credentials again.

---

<div class="post-metadata">

**Author:** ![darryncampbell](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/darryncampbell/32/20_2.png) [@darryncampbell](https://community.livekit.io/u/darryncampbell)\
**Post date:** [November 24, 2026, 10:20am UTC](https://community.livekit.io/t/livekit-cloud-api-returns-401-invalid-token-with-official-node-js-sdk/2585/4 "2026-11-24T10:20:33Z")

</div>

> [@xvii\_bad](#):
>
> Could LiveKit staff please verify whether my API key is active, correctly registered, and associated with the `missperfect-wkx5iwgk.livekit.cloud` domain?

I can see you have 2 keys, but I can see very little beyond that.

I think my first suggestion would be to see if you can get the LiveKit CLI working to do something simple like list rooms.

`lk cloud auth` (authenticates and creates key)

`lk project list` (to check you’re looking at the correct project, potentially needing `lk project set-default`)

`lk room list`

I know it’s not what you are trying to do, I’m just trying to get _ **something** _ working.
