![]() |
VOOZH | about |
Please note, this package is obsolete as of 10/01/2025 and is no longer maintained or monitored. Refer to our deprecation policy (https://aka.ms/azsdk/support-policies) for more details.
dotnet add package Azure.MixedReality.Authentication --version 1.2.0
NuGet\Install-Package Azure.MixedReality.Authentication -Version 1.2.0
<PackageReference Include="Azure.MixedReality.Authentication" Version="1.2.0" />
<PackageVersion Include="Azure.MixedReality.Authentication" Version="1.2.0" />Directory.Packages.props
<PackageReference Include="Azure.MixedReality.Authentication" />Project file
paket add Azure.MixedReality.Authentication --version 1.2.0
#r "nuget: Azure.MixedReality.Authentication, 1.2.0"
#:package Azure.MixedReality.Authentication@1.2.0
#addin nuget:?package=Azure.MixedReality.Authentication&version=1.2.0Install as a Cake Addin
#tool nuget:?package=Azure.MixedReality.Authentication&version=1.2.0Install as a Cake Tool
Mixed Reality services, like Azure Spatial Anchors, Azure Remote Rendering, and others, use the Mixed Reality security token service (STS) for authentication. This package supports exchanging Mixed Reality account credentials for an access token from the STS that can be used to access Mixed Reality services.
Install the Azure Mixed Reality Authentication client library for .NET with NuGet:
dotnet add package Azure.MixedReality.Authentication
Add a package reference:
<PackageReference Include="Azure.MixedReality.Authentication" Version="1.0.0" />
Mixed Reality services support a few different forms of authentication:
See here for detailed instructions and information.
Below are some examples of some common authentication scenarios, but more examples and information can be found at Azure.Identity.
Use the MixedRealityStsClient constructor overload accepting an AzureKeyCredential to configure account key
authentication with the Mixed Reality STS:
AzureKeyCredential keyCredential = new AzureKeyCredential(accountKey);
MixedRealityStsClient client = new MixedRealityStsClient(accountId, accountDomain, keyCredential);
Note: Account key authentication is not recommended for production applications.
TokenCredential aadCredential = new ClientSecretCredential(tenantId, clientId, clientSecret, new TokenCredentialOptions
{
AuthorityHost = new Uri($"https://login.microsoftonline.com/{tenantId}")
});
MixedRealityStsClient client = new MixedRealityStsClient(accountId, accountDomain, aadCredential);
Task deviceCodeCallback(DeviceCodeInfo deviceCodeInfo, CancellationToken cancellationToken)
{
Debug.WriteLine(deviceCodeInfo.Message);
Console.WriteLine(deviceCodeInfo.Message);
return Task.FromResult(0);
}
TokenCredential deviceCodeCredential = new DeviceCodeCredential(deviceCodeCallback, tenantId, clientId, new TokenCredentialOptions
{
AuthorityHost = new Uri($"https://login.microsoftonline.com/{tenantId}"),
});
MixedRealityStsClient client = new MixedRealityStsClient(accountId, accountDomain, deviceCodeCredential);
AccessToken token = await client.GetTokenAsync();
See here for more information about using device code authentication flow.
Use the DefaultAzureCredential object with includeInteractiveCredentials: true to use default interactive authentication
flow:
TokenCredential credential = new DefaultAzureCredential(includeInteractiveCredentials: true);
MixedRealityStsClient client = new MixedRealityStsClient(accountId, accountDomain, credential);
The MixedRealityStsClient is the client library used to access the Mixed Reality STS to get an access token.
Tokens obtained from the Mixed Reality STS have a lifetime of 24 hours.
We guarantee that all client instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing client instances is always safe, even across threads.
Client options | Accessing the response | Long-running operations | Handling failures | Diagnostics | Mocking | Client lifetime
AzureKeyCredential keyCredential = new AzureKeyCredential(accountKey);
MixedRealityStsClient client = new MixedRealityStsClient(accountId, accountDomain, keyCredential);
AccessToken token = await client.GetTokenAsync();
See the authentication examples above for more complex authentication scenarios.
Some Mixed Reality client libraries might accept an access token in place of a credential. For example:
// GetMixedRealityAccessTokenFromWebService is a hypothetical method that retrieves
// a Mixed Reality access token from a web service. The web service would use the
// MixedRealityStsClient and credentials to obtain an access token to be returned
// to the client.
AccessToken accessToken = await GetMixedRealityAccessTokenFromWebService();
SpatialAnchorsAccount account = new SpatialAnchorsAccount(accountId, accountDomain);
SpatialAnchorsClient client = new SpatialAnchorsClient(account, accessToken);
Note: The SpatialAnchorsClient usage above is hypothetical and may not reflect the actual library. Consult the
documentation for the client library you're using to determine if and how this might be supported.
Libraries supporting the Mixed Reality Authentication are coming soon.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on Azure.MixedReality.Authentication:
| Package | Downloads |
|---|---|
|
Azure.MixedReality.RemoteRendering
Package Description |
|
|
Azure.MixedReality.ObjectAnchors.Conversion
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.2.0 | 125,416 | 9/9/2022 | 1.2.0 is deprecated because it is no longer maintained. |
| 1.1.0 | 3,162 | 7/28/2022 | 1.1.0 is deprecated because it is no longer maintained. |
| 1.0.1 | 48,866 | 5/25/2021 | 1.0.1 is deprecated because it is no longer maintained. |
| 1.0.0 | 26,803 | 2/23/2021 | 1.0.0 is deprecated because it is no longer maintained. |
| 1.0.0-beta.2 | 565 | 2/16/2021 | 1.0.0-beta.2 is deprecated because it is no longer maintained. |
| 1.0.0-beta.1 | 413 | 2/11/2021 | 1.0.0-beta.1 is deprecated because it is no longer maintained. |