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

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!

Hi,

We have a blog post that covers this:

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

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:

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.

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.