Auth Token vs Room Code

When setting up video sessions, developers can choose between two options for granting access and authenticating peers: room codes or authentication tokens. But when is each appropriate? Here's a comparison, along with recommendations for common use cases.

  • Room codes are recommended for creating shareable join links for sessions. They can also power authentication for peers joining a session, eliminating the need to generate an authentication token.
  • Authentication tokens are ideal for peer authentication during join flows, particularly when your use case doesn't require join links.

Comparing the set up

Before integrating, it's important to define your implementation stack. Let's examine the key differences between the two.

Room CodesAuthentication Token
ParityEncrypted code representing a unique role and room_id combination.JWT token. Auth token is unique to a role, user_id and room_id.
Set-upUse server-side Room Codes APIs. Management Token is requiredServer-side set up to generate auth token. Management token is not required
ExpiryRoom Codes do not expire. Peers can access rooms using links created with room codes, unless disabled.Set a desired expiry for auth token. Peers cannot join a session if their auth token is expires.
User ContextAdditional user context can be passed to make these codes user specific.User ID can be passed when creating auth token

Key Recommendations

Let’s take a closer look on deciding which method to use when you’ve opted to build your user using 100ms Prebuilt and custom UI

ImplementationRoom CodesAuth Tokens
Prebuilt LinksUse room codes to create shareable Prebuilt links; can pass additional user context like user name and user IDNot required; as 100ms Prebuilt handles room codes implicitly handles authentication
Prebuilt ComponentAuthenticate peers and join using room codesAuthenticate peers and join using auth token
Custom LinksUse room codes to create shareable custom links; can pass additional user context like user name and user IDUse SDK method getAuthTokenByRoomCode to fetch auth token to join sessions. Alternatively, you can set up auth token setup at your end
Custom UIAuthenticate peers and join using room codesCan use authentication token to authenticate peers

In simpler terms,

  1. Room codes simplify link creation.
  2. Both room codes & auth tokens work for authenticating peers and joining a session.

Have a suggestion? Recommend changes ->

Was this helpful?

1234