Setup and Authentication
June 16, 2026 ยท View on GitHub
This guide shows how to migrate setup and authentication code from stream-chat-net to getstream-net.
Installation
Before (stream-chat-net):
dotnet add package stream-chat-net
After (getstream-net):
dotnet add package getstream-net
Key changes:
- The NuGet package name changes from
stream-chat-nettogetstream-net
Client Initialization
Before (stream-chat-net):
using StreamChat.Clients;
var clientFactory = new StreamClientFactory("your-api-key", "your-api-secret");
// Get individual clients
var userClient = clientFactory.GetUserClient();
var channelClient = clientFactory.GetChannelClient();
var messageClient = clientFactory.GetMessageClient();
var reactionClient = clientFactory.GetReactionClient();
var deviceClient = clientFactory.GetDeviceClient();
After (getstream-net):
using GetStream;
using GetStream.Models;
// Option 1: Provide credentials directly
var client = new StreamClient(apiKey: "your-api-key", apiSecret: "your-api-secret");
// Option 2: Use environment variables (STREAM_API_KEY, STREAM_API_SECRET)
var clientFromEnv = new ClientBuilder().Build();
// Access sub-clients
var chatClient = new ChatClient(client);
var moderationClient = new ModerationClient(client);
Key changes:
- Namespace changes from
StreamChat.ClientstoGetStreamandGetStream.Models - Single
StreamClientreplaces the factory pattern; sub-clients wrap it for domain-specific methods - Environment variables are
STREAM_API_KEYandSTREAM_API_SECRETinstead ofSTREAM_KEYandSTREAM_SECRET
Available sub-clients and builder methods:
| Sub-client | Direct | Builder |
|---|---|---|
| Chat | new ChatClient(client) | builder.BuildChatClient() |
| Video | new VideoClient(client) | builder.BuildVideoClient() |
| Moderation | new ModerationClient(client) | builder.BuildModerationClient() |
| Feeds | new FeedsV3Client(client) | builder.BuildFeedsClient() |
Client Initialization with Options
Before (stream-chat-net):
using StreamChat.Clients;
var clientFactory = new StreamClientFactory("your-api-key", "your-api-secret",
opts => opts.Timeout = TimeSpan.FromSeconds(5));
After (getstream-net):
using GetStream;
var client = new ClientBuilder()
.ApiKey("your-api-key")
.ApiSecret("your-api-secret")
.BaseUrl("https://chat.stream-io-api.com")
.Build();
Key changes:
ClientBuilderprovides a fluent API for configuration instead of an options callback
Token Generation
Before (stream-chat-net):
using StreamChat.Clients;
var clientFactory = new StreamClientFactory("your-api-key", "your-api-secret");
var userClient = clientFactory.GetUserClient();
// Without expiration
var token = userClient.CreateToken("user-id");
// With expiration
var token = userClient.CreateToken("user-id", expiration: DateTimeOffset.UtcNow.AddHours(1));
After (getstream-net):
using GetStream;
var client = new StreamClient(apiKey: "your-api-key", apiSecret: "your-api-secret");
// Without expiration
var token = client.CreateUserToken("user-id");
// With expiration
var token = client.CreateUserToken("user-id", expiration: TimeSpan.FromHours(1));
Key changes:
CreateToken()moves fromIUserClientto the mainStreamClientasCreateUserToken()- No need to get a separate user client just for token generation
expirationis aTimeSpan(token lifetime, defaults to 1 hour), not aDateTimeOffsettimestamp