Skip to content

Commit 7db5b3b

Browse files
Added a client consumption example (Azure#18463)
- In the board review, they requested that we add an example of how someone would consume the `AccessToken` in a client. No clients exist today, so we're keeping things hypothetical for now to make the point.
1 parent 09ee616 commit 7db5b3b

File tree

1 file changed

+19
-0
lines changed
  • sdk/mixedreality/Azure.MixedReality.Authentication

1 file changed

+19
-0
lines changed

sdk/mixedreality/Azure.MixedReality.Authentication/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ token from the STS that can be used to access Mixed Reality services.
2222
- [MixedRealityStsClient](#mixedrealitystsclient)
2323
- [Examples](#examples)
2424
- [Retrieve an access token](#retrieve-an-access-token)
25+
- [Using the access token in a Mixed Reality client library](#using-the-access-token-in-a-mixed-reality-client-library)
2526
- [Troubleshooting](#troubleshooting)
2627
- [Next steps](#next-steps)
2728
- [Client libraries supporting authentication with Mixed Reality Authentication](#client-libraries-supporting-authentication-with-mixed-reality-authentication)
@@ -159,6 +160,24 @@ AccessToken token = await client.GetTokenAsync(accountId);
159160

160161
See the authentication examples [above](#authenticate-the-client) for more complex authentication scenarios.
161162

163+
#### Using the access token in a Mixed Reality client library
164+
165+
Some Mixed Reality client libraries might accept an access token in place of a credential. For example:
166+
167+
```csharp
168+
// GetMixedRealityAccessTokenFromWebService is a hypothetical method that retrieves
169+
// a Mixed Reality access token from a web service. The web service would use the
170+
// MixedRealityStsClient and credentials to obtain an access token to be returned
171+
// to the client.
172+
AccessToken accessToken = await GetMixedRealityAccessTokenFromWebService();
173+
174+
SpatialAnchorsAccount account = new SpatialAnchorsAccount(accountId, accountDomain);
175+
SpatialAnchorsClient client = new SpatialAnchorsClient(account, accessToken);
176+
```
177+
178+
Note: The `SpatialAnchorsClient` usage above is hypothetical and may not reflect the actual library. Consult the
179+
documentation for the client library you're using to determine if and how this might be supported.
180+
162181
## Troubleshooting
163182

164183
- See [Error Handling](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/identity/Azure.Identity/README.md#error-handling) for Azure.Identity.

0 commit comments

Comments
 (0)