MCAuth.Testing
1.0.2
dotnet add package MCAuth.Testing --version 1.0.2
NuGet\Install-Package MCAuth.Testing -Version 1.0.2
<PackageReference Include="MCAuth.Testing" Version="1.0.2" />
<PackageVersion Include="MCAuth.Testing" Version="1.0.2" />
<PackageReference Include="MCAuth.Testing" />
paket add MCAuth.Testing --version 1.0.2
#r "nuget: MCAuth.Testing, 1.0.2"
#:package MCAuth.Testing@1.0.2
#addin nuget:?package=MCAuth.Testing&version=1.0.2
#tool nuget:?package=MCAuth.Testing&version=1.0.2
MCAuth.Testing
Testing library for MCAuth. This is used for testing purposes only. It automatically mocks HTTP requests made by the library and returns a custom response provided by you.
Usage
The only difference from the main library is the initial creation of the client. You must set up your mock responses for authentication to return a successful response. The bare minimum that is required for your mock is the microsoft login code, redirect URL, Minecraft ID, and Minecraft username. Here is an example of that:
var code = "M.C503_AB1.2.U.01234567-89ab-cdef-0123-456789abcdef";
var redirectUrl = "https://my-app.com/login";
var client = new MCAuthTestClient("AZURE_CLIENT_ID", "AZURE_CLIENT_SECRET")
.WithAllowedValues(new List<MCAuthTestAllowedAuth> {
new MCAuthTestAllowedAuth(code, redirectUrl, "MINECRAFT_ID", "MINECRAFT_USERNAME");
});
And here is an example of a mock which provides all possible values:
var code = "M.C503_AB1.2.U.01234567-89ab-cdef-0123-456789abcdef";
var redirectUrl = "https://my-app.com/login";
var client = new MCAuthTestClient("AZURE_CLIENT_ID", "AZURE_CLIENT_SECRET")
.WithAllowedValues(new List<MCAuthTestAllowedAuth> {
new MCAuthTestAllowedAuth(
code,
redirectUrl,
new MCAuthTestResponse(new MinecraftProfileAuthTestResponse("MINECRAFT_ID", "MINECRAFT_USERNAME") {
Capes = ImmutableList<MinecraftProfileAuthCape>.Empty.Add(new MinecraftProfileAuthCape {
Id = "00000000-1111-2222-3333-444444444444",
State = "ACTIVE",
Url = $"{MCAuthConstants.MinecraftTexturesAddress.ToString()}/fedcba09876543211234567890abcdeffedcba09876543211234567890abcdef",
Alias = "TestCape"
}),
Skins = ImmutableList<MinecraftProfileAuthSkin>.Empty.Add(new MinecraftProfileAuthSkin {
Id = "11111111-2222-3333-4444-555555555555",
State = "ACTIVE",
Url = $"{MCAuthConstants.MinecraftTexturesAddress.ToString()}/1234567890abcdeffedcba09876543211234567890abcdeffedcba0987654321",
TextureKey = "1234567890abcdeffedcba09876543211234567890abcdeffedcba0987654321",
Variant = "CLASSIC",
Alias = null
})
}) {
MicrosoftToken = new MicrosoftAuthTestTokenResponse {
UserId = "22222222-3333-4444-5555-666666666666",
Foci = ""
},
XboxLiveToken = new XboxLiveAuthTestTokenResponse {
Uhs = "1234567890"
},
MinecraftToken = new MinecraftAuthTestTokenResponse {
Username = "33333333-4444-5555-6666-777777777777",
Roles = ImmutableList<object>.Empty.Add("TestRole"),
Metadata = ImmutableDictionary<string, object>.Empty.Add("TestMetadata", 1234)
}
}
);
});
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.0
- MCAuth (>= 1.0.2)
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 |
|---|---|---|
| 1.0.2 | 36 | 2/19/2026 |
Initial 1.0.0 release