CodeLogic.SocialConnect
4.9.106
See the version list below for details.
dotnet add package CodeLogic.SocialConnect --version 4.9.106
NuGet\Install-Package CodeLogic.SocialConnect -Version 4.9.106
<PackageReference Include="CodeLogic.SocialConnect" Version="4.9.106" />
<PackageVersion Include="CodeLogic.SocialConnect" Version="4.9.106" />
<PackageReference Include="CodeLogic.SocialConnect" />
paket add CodeLogic.SocialConnect --version 4.9.106
#r "nuget: CodeLogic.SocialConnect, 4.9.106"
#:package CodeLogic.SocialConnect@4.9.106
#addin nuget:?package=CodeLogic.SocialConnect&version=4.9.106
#tool nuget:?package=CodeLogic.SocialConnect&version=4.9.106
CodeLogic.SocialConnect
Discord webhooks and Steam integration for CodeLogic 4 — send rich Discord notifications, read Steam player profiles, bans, and game libraries, and add "Sign in through Steam" to a website.
Four services behind one library: a Discord webhook sender (text, rich embeds, full payloads), a Steam profile reader (players, bans, owned games — cached), Steam authentication for validating game-session tickets, and Steam sign-in (OpenID 2.0) for websites. No external NuGet dependencies — built on System.Net.Http.Json.
Install
dotnet add package CodeLogic.SocialConnect
Quick start
using CL.SocialConnect;
await Libraries.LoadAsync<SocialConnectLibrary>();
await CodeLogic.ConfigureAsync();
await CodeLogic.StartAsync();
var social = Libraries.Get<SocialConnectLibrary>();
// Discord — send a webhook text message (Result, no value)
Result sent = await social.Discord.SendMessageAsync("Server restarted");
if (sent.IsFailure)
Console.WriteLine(sent.Error?.Message);
// Steam — fetch a player profile (Result<SteamPlayer>)
if (social.HasSteam)
{
Result<SteamPlayer> player = await social.Steam.GetPlayerAsync("76561198012345678");
if (player.IsSuccess)
Console.WriteLine($"{player.Value.PersonaName} — {player.Value.ProfileUrl}");
}
// Steam — "Sign in through Steam" on a website (OpenID 2.0; returns the Steam ID)
if (social.HasSteamOpenId)
{
// 1. Redirect the browser. Keep the per-attempt state in a cookie.
var returnTo = $"https://example.com/auth/steam/callback?state={state}";
string loginUrl = social.OpenId.BuildLoginUrl(returnTo);
// 2. On the callback, verify against the exact return_to you sent.
Result<SteamOpenIdResult> signIn = await social.OpenId.VerifyAsync(callbackQueryString, returnTo);
if (signIn.IsSuccess)
Console.WriteLine($"Signed in as {signIn.Value.SteamId}");
}
Accessing a disabled service throws InvalidOperationException. Guard with HasDiscord / HasSteam / HasSteamAuth / HasSteamOpenId when a service may be turned off — Steam is disabled by default.
Features
- Discord webhooks —
SendMessageAsync(plain text, max 2000 chars),SendEmbedAsync(up to 10 rich embeds), andSendAsync(fullDiscordWebhookMessage); all returnResult. - Rich embeds — title, description, colour, fields, author, footer, image, thumbnail, and timestamp via
DiscordEmbed/DiscordEmbedField. - Mention control —
DiscordAllowedMentions(with.None/.All) whitelists which roles/users/@everyonemay ping; opt-in TTS viaDiscordWebhookMessage.Tts. - Steam profiles —
GetPlayerAsync,GetPlayerBansAsync,GetOwnedGamesAsyncreturnResult<T>with computed helpers (IsPublic,IsInGame,HasAnyBan,TotalPlaytime,LastPlayed). - Built-in cache — Steam reads are cached for
CacheTtlSeconds(default 300); clear on demand withSteam.ClearCache(). - Steam authentication —
Auth.AuthenticateAsyncvalidates a session ticket, with a per-callappIdoverride. - Steam sign-in —
OpenId.BuildLoginUrl/OpenId.VerifyAsyncimplement "Sign in through Steam" (OpenID 2.0): local checks of the signed assertion (endpoint,return_to, identity, signed fields), then confirmation by Steam (check_authentication). Returns the 64-bit Steam ID. - Events —
WebhookSentEvent,SteamProfileFetchedEvent,SteamAuthenticatedEvent, andSteamOpenIdVerifiedEventon the CodeLogic event bus.
Configuration
Auto-generated on first run as config.socialconnect.json:
{
"Enabled": true,
"Discord": {
"Enabled": true,
"DefaultWebhookUrl": "https://discord.com/api/webhooks/xxx/yyy",
"TimeoutSeconds": 10,
"DefaultUsername": "MyApp",
"DefaultAvatarUrl": "https://example.com/bot.png"
},
"Steam": {
"Enabled": false,
"ApiKey": "your-steam-web-api-key",
"AuthEnabled": false,
"AppId": "",
"OpenIdEnabled": true,
"CacheTtlSeconds": 300,
"TimeoutSeconds": 15,
"ApiBaseUrl": "https://api.steampowered.com"
}
}
| Setting | Default | Description |
|---|---|---|
Enabled |
true |
Master switch for the whole library. |
Discord.Enabled |
true |
Enable the Discord webhook service. |
Discord.DefaultWebhookUrl |
"" |
Webhook used when a call omits webhookUrl (secret). |
Discord.TimeoutSeconds |
10 |
HTTP timeout for Discord calls (1–120). |
Discord.DefaultUsername |
"" |
Default sender name applied to messages. |
Discord.DefaultAvatarUrl |
"" |
Default sender avatar applied to messages. |
Steam.Enabled |
false |
Enable the Steam profile service; requires ApiKey. |
Steam.ApiKey |
"" |
Steam Web API key (secret) — get one at steamcommunity.com/dev/apikey. |
Steam.AuthEnabled |
false |
Enable ticket authentication; requires AppId. |
Steam.AppId |
"" |
Your game's Steam App ID (used by auth). |
Steam.OpenIdEnabled |
true |
Enable "Sign in through Steam" (OpenID) while Steam is enabled. OpenID itself needs no key. |
Steam.CacheTtlSeconds |
300 |
Profile cache lifetime in seconds (must be > 0). |
Steam.TimeoutSeconds |
15 |
HTTP timeout for Steam calls (1–120). |
Steam.ApiBaseUrl |
https://api.steampowered.com |
Steam Web API base URL. |
Changing config while running
With CodeLogic 4.9+, config.socialconnect.json applies live when changed through Libraries.UpdateConfigAsync, Libraries.ReloadConfigAsync, or the config file watcher. Only the service whose settings changed is rebuilt:
- Discord settings:
social.Discordis replaced. - Steam settings:
social.Steam,social.Authandsocial.OpenIdare replaced; the profile cache starts empty. - Enabled flags: each service, and the whole library, can be switched on or off.
A replaced service is disposed only after its request timeout, so requests already running on it finish. Read social.Discord / social.Steam / social.Auth / social.OpenId when you use them rather than keeping an old instance.
Documentation
Full guide: CL.SocialConnect documentation
Requirements
- CodeLogic 4.9+ · .NET 10
- No external NuGet dependencies
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- CodeLogic (>= 4.9.0 && < 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.116-preview | 27 | 11/1/2026 |
| 5.0.115-preview | 82 | 11/1/2026 |
| 5.0.114-preview | 31 | 10/31/2026 |
| 5.0.113-preview | 32 | 10/31/2026 |
| 4.9.106 | 40 | 10/30/2026 |
| 4.9.100 | 45 | 10/26/2026 |
| 4.9.98 | 46 | 10/25/2026 |
| 4.8.93 | 66 | 9/23/2026 |
| 4.8.87 | 77 | 9/13/2026 |
| 4.8.85 | 61 | 9/12/2026 |
| 4.6.72 | 231 | 6/20/2026 |
| 4.6.69-preview | 60 | 6/20/2026 |
| 4.5.2 | 138 | 5/24/2026 |
| 4.5.2-preview.68 | 91 | 6/20/2026 |
| 4.5.1 | 194 | 5/24/2026 |
| 4.5.1-preview.56 | 122 | 5/24/2026 |
| 4.4.2-preview.53 | 92 | 5/24/2026 |
| 4.4.1 | 136 | 5/24/2026 |
| 4.0.5 | 128 | 5/15/2026 |
| 4.0.4 | 143 | 5/9/2026 |
# CL.SocialConnect — Changelog
All notable changes to **CodeLogic.SocialConnect** are documented here. Versions follow
[Semantic Versioning](https://semver.org/).
## 2026-10-30
### Fixed
- **Health with every service switched off is Healthy** (`No services enabled`). It reported Unhealthy
"Not initialized — no services active", although services are only ever absent because the config
turns them off — an app that uses only some of the library (or none of it yet) showed as broken.
## 2026-10-26
### Added
- **Steam sign-in (OpenID 2.0)** for websites: `SteamOpenIdService`, exposed as `social.OpenId` with
`HasSteamOpenId`. `BuildLoginUrl(returnTo, realm?)` builds the "Sign in through Steam" redirect;
`VerifyAsync(query, expectedReturnTo)` checks the signed assertion locally (Steam's endpoint and
namespace, exact `return_to`, `claimed_id` = `identity` as a SteamID64, required signed fields, no
repeated parameters), then asks Steam to confirm it (`check_authentication`), and returns the
player's 64-bit Steam ID as `Result<SteamOpenIdResult>`. Publishes `SteamOpenIdVerifiedEvent`.
- `Steam.OpenIdEnabled` (default `true`): sign-in is available whenever Steam is enabled (which
requires `Steam.ApiKey`). It follows live config changes like the other Steam services: a Steam
settings change replaces `social.OpenId`, and it can be switched on or off without a restart.
## 2026-10-24
### Added
- **Live config changes** (requires CodeLogic 4.9+). `SocialConnectLibrary` implements
`IConfigReloadable`: a change to `config.socialconnect.json` made through `Libraries.UpdateConfigAsync`,
`Libraries.ReloadConfigAsync` or the config file watcher is applied without a restart, rebuilding only
the service whose settings changed (`Discord`, or `Steam` + `Auth`). Services and the library can be
switched on or off. A replaced service is disposed after its request timeout, so running requests finish.
## 2026-09-12
### Changed
- Unified the version line with the CodeLogic framework on **4.8.x**. Every official
library and the framework now share one `major.minor`, so a given `4.8.<patch>`
means the same generation across all packages.
- `version.txt` moved from `4.6` to `4.8`. The patch component remains the CI run
number, composed at pack time; `AssemblyVersion` stays pinned at `Major.Minor.0.0`
(now `4.8.0.0`) so every patch in the line loads interchangeably.
## 2026-06-20
### Fixed
- Discord sends now validate the 2000-character content limit and 10-embed limit
up front, returning a clear validation error instead of a failed HTTP
round-trip.
- Corrected the `CommunityVisibilityState` documentation comment (the Steam Web
API returns 1 = not visible / 3 = public to third parties; the previous
comment listed nonexistent levels).
### Documentation
- Full rewrite of the README and the `docs/libs/socialconnect.md` guide to the
current house style.
- README restructured to the standard layout (badges, tagline, intro, Install,
Quick start, Features, Configuration with table + JSON, Documentation,
Requirements, License) and now links the published docs page.
- Corrected the `Result` contract throughout: Discord methods return `Result`
(no value); Steam profile and auth methods return `Result<T>`. Examples use
`IsSuccess` / `IsFailure`, `.Value`, and `Error?.Message`.
- Documented the canonical load sequence (`LoadAsync` → `ConfigureAsync` →
`StartAsync` → `Libraries.Get`) and the `HasDiscord` / `HasSteam` /
`HasSteamAuth` guards (Steam disabled by default).
- Added a deep guide covering the three services, Discord webhook methods and
full model reference (with a rich-embed example), the Steam profile/bans/games
models and computed properties, Steam ticket authentication, caching
(`CacheTtlSeconds`, `ClearCache`), configuration, events, and the health check.
## [4.5.2] — 2026-06-20
### Documentation
- Corrected the README Quick Start: the text-message helper is
`Discord.SendMessageAsync(...)`, not `SendAsync(string, username:)`.
- Fixed the README configuration example to use PascalCase JSON keys and added the
previously omitted `DefaultAvatarUrl`, `AuthEnabled`, `AppId`, and `ApiBaseUrl` fields.
- Documented previously undocumented user-facing API surface:
- Discord `SendAsync(DiscordWebhookMessage)`, `DiscordAllowedMentions`
(`.None` / `.All`), and the `Tts` flag.
- Steam `SteamProfileService.ClearCache()` and the `GetOwnedGamesAsync`
`includeAppInfo` parameter.
- Per-call `appId` override on `Auth.AuthenticateAsync`.
- `SteamPlayer` (`IsPublic`, `IsInGame`, `AccountCreated`), `SteamPlayerBans`
(`HasAnyBan`), and `SteamGame` (`TotalPlaytime`, `RecentPlaytime`, `LastPlayed`,
`GetIconUrl`) computed helpers; the `DiscordUser` model.
- `HasDiscord` / `HasSteam` / `HasSteamAuth` availability properties and the
`InvalidOperationException` thrown when a disabled service is accessed.
- Event-bus events `WebhookSentEvent`, `SteamProfileFetchedEvent`, and
`SteamAuthenticatedEvent`, and the `SocialError` failure-code enum.
## [4.5.0] — 2026-05-24
### Changed
- **Unified versioning.** All CodeLogic.Libs now share a single version line
controlled by `version.txt` in the repo root. This is a version alignment
release — no functional changes to this library.
## [4.0.4] — 2026-04-16
### Changed
- README + manifest refresh for the v4 baseline. No functional changes vs 4.0.3.
- `LibraryManifest.Version` now reads from assembly metadata.
## [4.0.2] — 2026-04-09
### Changed
- Annotated SocialConnect configuration with `[ConfigField]` for the admin UI surface.
- Aligned with the v4 baseline across all libraries.
### Fixed
- Closed resource leaks in the OAuth client + reworked the health check so
it no longer mutates internal state as a side-effect.
## [4.0.0] — 2026-04-09
Major rewrite. Republished as v4.0.0 to reset the version line under the
unified v4 baseline. OAuth/OIDC providers (Google, Discord, Steam,
generic OIDC) with a uniform abstraction.
### Notes
- Earlier history is retained in the
[git log](https://github.com/zyntal-com/CodeLogic.Libs/commits/main/CL.SocialConnect).