VOOZH about

URL: https://www.nuget.org/packages/XboxAuthNet.Uno/

⇱ NuGet Gallery | XboxAuthNet.Uno 1.0.0




XboxAuthNet.Uno 1.0.0

dotnet add package XboxAuthNet.Uno --version 1.0.0
 
 
NuGet\Install-Package XboxAuthNet.Uno -Version 1.0.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XboxAuthNet.Uno" Version="1.0.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XboxAuthNet.Uno" Version="1.0.0" />
 
Directory.Packages.props
<PackageReference Include="XboxAuthNet.Uno" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XboxAuthNet.Uno --version 1.0.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XboxAuthNet.Uno, 1.0.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XboxAuthNet.Uno@1.0.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XboxAuthNet.Uno&version=1.0.0
 
Install as a Cake Addin
#tool nuget:?package=XboxAuthNet.Uno&version=1.0.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

XboxAuthNet.Uno

Microsoft OAuth 2.0 and Xbox Authentication migrated to the Uno Platform

Original repo

Features

Install

👁 Install nuget package XboxAuthNet.Uno

XboxAuthNet.Uno

Usage: Microsoft OAuth

Currently only auth code flow is supported.

// Initialize API client
var httpClient = new HttpClient();
var apiClient = new MicrosoftOAuthCodeApiClient("<CLIENT-ID>", "<SCOPES>", httpClient); // replace "SCOPES" to XboxAuth.XboxScope for Xbox Authentication

// Authenticate with auth code flow
var codeFlow = new MicrosoftOAuthCodeFlowBuilder(apiClient)
 .Build();
MicrosoftOAuthResponse result = await codeFlow.Authenticate();

// `result.AccessToken` can be used on Xbox Authentication
// store `result` variable to refresh token later.
// `MicrosoftOAuthResponse` can be serialized (like json)
Console.WriteLine(result.AccessToken);
Console.WriteLine(result.RefreshToken);

Refresh Microsoft OAuth Token

if (!result.Validate())
{
 var newResult = await apiClient.RefreshToken(result.RefreshToken, CancellationToken.None);
 Console.WriteLine(newResult.AccessToken);
 Console.WriteLine(newResult.RefreshToken);
}

Usage: Xbox Authentication

There are three Xbox authentication methods. You can find a description of each method here.

Xbox Basic Authentication

var httpClient = new HttpClient();
var xboxAuthClient = new XboxAuthClient(httpClient);

var userToken = await xboxAuthClient.RequestUserToken("<microsoft_oauth2_access_token>");
var xsts = await xboxAuthClient.RequestXsts(userToken.Token, "<relying_party>");

Console.WriteLine(xsts.Token);

Xbox Full Authentication

var httpClient = new HttpClient();
var xboxAuthClient = new XboxAuthClient(httpClient);

var userToken = await xboxAuthClient.RequestSignedUserToken(new XboxSignedUserTokenRequest
{
 AccessToken = "<microsoft_oauth2_access_token>",
 TokenPrefix = AbstractXboxAuthRequest.XboxTokenPrefix
});
var deviceToken = await xboxAuthClient.RequestDeviceToken(new XboxDeviceTokenRequest
{
 DeviceType = XboxDeviceTypes.Nintendo,
 DeviceVersion = "0.0.0"
});
var titleToken = await xboxAuthClient.RequestTitleToken(new XboxTitleTokenRequest
{
 AccessToken = "<microsoft_oauth2_access_token>",
 DeviceToken = deviceToken.Token
});
var xsts = await xboxAuthClient.RequestXsts(new XboxXstsRequest
{
 UserToken = userToken.Token,
 DeviceToken = deviceToken.Token,
 TitleToken = titleToken.Token,
 RelyingParty = "<relying_party>"
});

Console.WriteLine(xsts.Token);

Xbox Sisu Authentication

var httpClient = new HttpClient();
var xboxAuthClient = new XboxAuthClient(httpClient);

var deviceToken = await xboxAuthClient.RequestDeviceToken(XboxDeviceTypes.Win32, "0.0.0");
var sisuResult = await xboxAuthClient.SisuAuth(new XboxSisuAuthRequest
{
 AccessToken = "<microsoft_oauth2_access_token>",
 ClientId = XboxGameTitles.MinecraftJava,
 DeviceToken = deviceToken.Token,
 RelyingParty = "<relying_party>"
});

Console.WriteLine(xsts.Token);

Example

References

These documents explain how Microsoft OAuth 2.0 works.

Microsoft OAuth 2.0

Desktop application calling a web api (XboxAuthNet implements interactive authentication)

This project was made possible thanks to the contributions of various open-source projects. not used any document from NDA developer program

MSAL.NET

xbox-live-api

xboxlive-auth

prismarine-auth

Product Versions Compatible and additional computed target framework versions.
.NET net7.0 net7.0 is compatible.  net7.0-android net7.0-android was computed.  net7.0-android33.0 net7.0-android33.0 is compatible.  net7.0-ios net7.0-ios was computed.  net7.0-ios16.1 net7.0-ios16.1 is compatible.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-maccatalyst16.1 net7.0-maccatalyst16.1 is compatible.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net7.0-windows10.0.19041 net7.0-windows10.0.19041 is compatible.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on XboxAuthNet.Uno:

Package Downloads
XboxAuthNet.Game.Uno

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 412 7/29/2023