Den.Dev.Conch
0.0.2
dotnet add package Den.Dev.Conch --version 0.0.2
NuGet\Install-Package Den.Dev.Conch -Version 0.0.2
<PackageReference Include="Den.Dev.Conch" Version="0.0.2" />
<PackageVersion Include="Den.Dev.Conch" Version="0.0.2" />
<PackageReference Include="Den.Dev.Conch" />
paket add Den.Dev.Conch --version 0.0.2
#r "nuget: Den.Dev.Conch, 0.0.2"
#:package Den.Dev.Conch@0.0.2
#addin nuget:?package=Den.Dev.Conch&version=0.0.2
#tool nuget:?package=Den.Dev.Conch&version=0.0.2
Conch
A tiny C#-based library to help authenticate against Xbox services.
This library is provided for educational and personal use purposes only. It comes with no guarantees, implied or otherwise.
By using this library, you acknowledge and agree to the following:
- You interact with Xbox Live APIs at your own risk
- Microsoft and Xbox may ban, suspend, or restrict accounts that use unofficial or unsanctioned APIs and projects (such as this library)
- I bear no responsibility for any account bans, restrictions, suspensions, or other consequences that may result from using this library
- You accept full responsibility for how you choose to use this library and any actions taken with it
About
Conch is an Xbox Live authentication library designed to handle the complexities of Microsoft's authentication flows. It was created to support Grunt, a command-line tool for interacting with Xbox Live services.
Key Capabilities
- OAuth 2.0 Authentication - Generate authorization URLs and exchange codes for tokens
- Token Management - Request and refresh OAuth tokens with scope customization
- Xbox Live User Tokens - Acquire user authentication tickets
- Device Tokens - Generate device tokens for XSTS authentication
- XSTS Tokens - Request Xbox Live Security Token Service (XSTS) tokens
- SISU Authentication - Support for SISU (Sign-In/Sign-Up) authentication flows
- Proof-of-Possession (PoP) Signing - Cryptographic request signing for secure API calls
Installation
Install via NuGet:
dotnet add package Den.Dev.Conch
Or via the Package Manager Console:
Install-Package Den.Dev.Conch
Quick Start
using Den.Dev.Conch.Authentication;
// Create the authentication client
var authClient = new XboxAuthenticationClient();
// Generate an authorization URL for the user to visit
string authUrl = authClient.GenerateAuthUrl(
clientId: "your-client-id",
redirectUrl: "your-redirect-url"
);
// After user authorization, exchange the code for an OAuth token
var oauthToken = await authClient.RequestOAuthToken(
clientId: "your-client-id",
authorizationCode: "code-from-redirect",
redirectUrl: "your-redirect-url"
);
// Request a user token
var userToken = await authClient.RequestUserToken(oauthToken.AccessToken);
// Request an XSTS token
var xstsToken = await authClient.RequestXstsToken(userToken.Token);
// Assemble the Xbox Live 3.0 token for API calls
string xblToken = authClient.GetXboxLiveV3Token(
xstsToken.DisplayClaims.Xui[0].UserHash,
xstsToken.Token
);
Using SISU Authentication
For scenarios requiring device and title tokens:
// Request a device token
var deviceToken = await authClient.RequestDeviceToken();
// Initialize a SISU session
var sisuSession = await authClient.RequestSISUSession(
appId: "your-app-id",
titleId: "your-title-id",
deviceToken: deviceToken.Token,
offers: new List<string> { "your-offers" },
redirectUri: "your-redirect-url"
);
// After user authorization, request SISU tokens
var sisuTokens = await authClient.RequestSISUTokens(
deviceToken: deviceToken.Token,
accessToken: "access-token-from-oauth",
appId: "your-app-id",
sessionId: sisuSession.SessionId
);
Error Handling
All authentication methods return null when they fail. Always check for null before using the result:
var oauthToken = await authClient.RequestOAuthToken(clientId, code, redirectUrl);
if (oauthToken == null)
{
// Handle authentication failure
Console.WriteLine("Failed to obtain OAuth token");
return;
}
var userToken = await authClient.RequestUserToken(oauthToken.AccessToken);
if (userToken == null)
{
// Handle user token failure
Console.WriteLine("Failed to obtain user token");
return;
}
// Check token expiration before use
if (oauthToken.ExpiresIn <= 0)
{
// Token may be expired, refresh it
oauthToken = await authClient.RefreshOAuthToken(
clientId,
oauthToken.RefreshToken,
redirectUrl
);
}
Contributing
See CONTRIBUTING.md for guidelines on how to contribute to this project.
License
This project is licensed under the MIT License. See the LICENSE file for details.
| 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
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Den.Dev.Conch:
| Package | Downloads |
|---|---|
|
Den.Dev.Grunt
An unofficial wrapper for the Halo APIs. Currently supports the full API stack for Halo Infinite. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release of the Den.Dev.Conch package.