Authless Users

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

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:

const FUser User{TEXT("tommaso")};
Client->ConnectGuestUser(
  User,
  [](const FOwnUser& Guest)
  {
    // Guest connected
  });

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

Anonymous Users

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.

Client->ConnectAnonymousUser(
  [](const FOwnUser& User)
  {
    // Connected
  });

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

{
  "id": "!anon",
  "role": "anonymous",
  "roles": [],
  "created_at": "0001-01-01T00:00:00Z",
  "updated_at": "0001-01-01T00:00:00Z",
  "last_active": "2020-11-02T18:36:01.125136Z",
  "banned": false,
  "online": true,
  "invisible": false,
  "devices": [],
  "mutes": [],
  "channel_mutes": [],
  "unread_count": 0,
  "total_unread_count": 0,
  "unread_channels": 0,
  "language": ""
}

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

© Getstream.io, Inc. All Rights Reserved.