Authless Users

LAST EDIT Oct 11 2024

Stream Chat also lets you give unauthenticated users with access to a limited subset of Stream's capabilities. This is done by using either Guest or Anonymous users.

These two user types are ideal for use cases where users either need to be able to see chat activity prior to authenticating or in scenarios where the additional friction of creating a user account might be unnecessary for a user.

Guest Users

Copied!

Guest sessions can be created client-side and do not require any server-side authentication. Support and livestreams are common use cases for guests users because really often you want a visitor to be able to use chat on your application without (or before) they have a regular user account.

Guest users are not available to application using multi-tenancy (teams).

Guest users are counted towards your MAU usage.

Guest users have a limited set of permissions. You can read more about how to configure permissions here. You can create a guest user session by using setGuestUser instead of connectUser.

You can generate a guest user in a front end client by using the following code:

The user object schema is the same as the one described in the Setting the user portion of the docs.

Anonymous Users

Copied!

If a user is not logged in, you can call the connectAnonymousUser method. While you’re anonymous, you can’t do much by default, but for the livestream channel type, you’re still allowed to read the chat conversation.

When you connect to chat using anonymously you receive a special user back with the following data:

Anonymous users are not counted toward your MAU number and only have an impact on the number of concurrent connected clients.
Anonymous users are not allowed to perform any write operations