XboxAuthNet 3.0.0-beta.1

This is a prerelease version of XboxAuthNet.
There is a newer version of this package available.
See the version list below for details.
dotnet add package XboxAuthNet --version 3.0.0-beta.1                
NuGet\Install-Package XboxAuthNet -Version 3.0.0-beta.1                
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" Version="3.0.0-beta.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XboxAuthNet --version 3.0.0-beta.1                
#r "nuget: XboxAuthNet, 3.0.0-beta.1"                
#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.
// Install XboxAuthNet as a Cake Addin
#addin nuget:?package=XboxAuthNet&version=3.0.0-beta.1&prerelease

// Install XboxAuthNet as a Cake Tool
#tool nuget:?package=XboxAuthNet&version=3.0.0-beta.1&prerelease                

XboxAuthNet

Xbox Live authentication

Ported from xboxlive-auth

Install

Nuget Package: XboxAuthNet
or download dlls from release

Sample program

XboxAuthNetTest

Usage

Microsoft OAuth: Getting new tokens

MicrosoftOAuth oauth = new MicrosoftOAuth("CLIENT_ID", "SCOPE");
string url = oauth.CreateUrl(); // show url into webbrowser

// execute below codes when the url of webbrowser is changed (ex: NavigationStarting event)
// redirectUrl: new url of webbrowser
if (oauth.CheckLoginSuccess(redirectUrl))
{
  MicrosoftOAuthResponse response;
  if (oauth.TryGetTokens(out response)
  {
    // success to get MicrosoftOAuth token
    // cache AccessToken, RefreshToken and ExpireIn to use next time
    
    // response.AccessToken
    // response.ExpireIn
    // response.RefreshToken
    // response.Scope
    // response.TokenType
    // response.UserId
  }
  else
  {
    // failed to login
  }
}

Microsoft OAuth: Validating & Refreshing tokens

MicrosoftOAuth oauth = new MicrosoftOAuth("CLIENT_ID", "SCOPE");
MicrosoftOAuthResponse response = ~~~; // read from cache

if (oauth.TryGetTokens(out response, response.RefreshToken)
{
  // success
  // response.AccessToken
}
else
{
  // failed to refresh tokens
}

XboxLive Login

XboxAuth xbox = new XboxAuth();
var rps = xbox.ExchangeRpsTicketForUserToken("Microsoft OAuth AccessToken");
var xsts = xbox.ExchangeTokensForXSTSIdentity(
  rps.Token, // userToken
  null, // deviceToken
  null, // titleToken
  "relyingParty", // relyingParty 
  null); // optionalDisplayClaims

if (xsts.IsSuccess)
{
  // success
  // xsts.Token: XSTS Token
  // xsts.UserHash: UserHash (uhs)
  // xsts.UserXUID
  // xsts.IssueInstant
  // xsts.ExpireOn
}
else
{
  // fail
  // xsts.Error
  // xsts.Message
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net5.0-windows7.0 is compatible.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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:

Package Downloads
XboxAuthNet.Game

XboxAuthNet.Game

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.4 604 8/21/2024
3.0.3 122 8/20/2024
3.0.2 2,508 7/7/2023
3.0.1 168 7/7/2023
3.0.0 1,066 6/24/2023
3.0.0-beta.3 201 4/2/2023
3.0.0-beta.2 169 2/4/2023
3.0.0-beta.1 134 1/5/2023
2.2.0 3,066 9/7/2022
2.2.0-beta8 313 8/31/2022
2.1.0 1,569 7/29/2022
2.0.0 1,245 7/8/2022
2.0.0-beta1 164 5/29/2022
1.4.2 2,508 10/5/2021
1.4.1 662 8/22/2021
1.4.0 460 7/4/2021
1.3.0 502 12/28/2020
1.2.0 386 12/25/2020
1.1.0 421 12/14/2020
1.0.2 370 12/13/2020
1.0.1 462 12/13/2020
1.0.0 451 12/13/2020