Skip to content

Commit 736afc9

Browse files
authored
Merge pull request #115361 from michael-house/patch-1
Update authentication for MSAL
2 parents d74e845 + f9a3f4e commit 736afc9

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

articles/spatial-anchors/concepts/authentication.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ms.author: pmorgan
99
ms.date: 05/28/2019
1010
ms.topic: conceptual
1111
ms.service: azure-spatial-anchors
12-
ms.custom: has-adal-ref
1312
---
1413
# Authentication and authorization to Azure Spatial Anchors
1514

@@ -94,7 +93,7 @@ For applications targeting Azure Active Directory users, the recommended approac
9493
1. Register your application in Azure AD as **Native application**. As part of registering, you will need to determine whether your application should be multi-tenant or not, and provide the redirect URLs allowed for your application.
9594
1. Switch to the **API permissions** tab
9695
2. Select **Add a permission**
97-
1. Select **Mixed Reality Resource Provider** under **APIs my organization uses** tab
96+
1. Select **Microsoft Mixed Reality** under **APIs my organization uses** tab
9897
2. Select **Delegated permissions**
9998
3. Check the box for **mixedreality.signin** under **mixedreality**
10099
4. Select **Add permissions**
@@ -107,12 +106,12 @@ For applications targeting Azure Active Directory users, the recommended approac
107106
2. In the **Select** field, enter the name of the user(s), group(s), and/or application(s) to which you want to assign access.
108107
3. Hit **Save**.
109108
2. In your code:
110-
1. Make sure to use the **application ID** and **redirect Uri** of your own Azure AD application as the **client ID** and **RedirectUri** parameters in ADAL
109+
1. Make sure to use the **application ID** and **redirect Uri** of your own Azure AD application as the **client ID** and **RedirectUri** parameters in MSAL
111110
2. Set the tenant information:
112111
1. If your application supports **My organization only**, replace this value with your **Tenant ID** or **Tenant name** (for example, contoso.microsoft.com)
113112
2. If your application supports **Accounts in any organizational directory**, replace this value with **Organizations**
114113
3. If your application supports **All Microsoft account users**, replace this value with **Common**
115-
3. On your token request, set the **resource** to "https://sts.mixedreality.azure.com". This "resource" will indicate to Azure AD that your application is requesting a token for the Azure Spatial Anchors service.
114+
3. On your token request, set the **scope** to "https://sts.mixedreality.azure.com//.default". This scope will indicate to Azure AD that your application is requesting a token for the Mixed Reality Security Token Service (STS).
116115

117116
With that, your application should be able to obtain from MSAL an Azure AD token; you can set that Azure AD token as the **authenticationToken** on your cloud session config object.
118117

@@ -180,16 +179,16 @@ The Azure AD access token is retrieved using the [MSAL library](../../active-dir
180179
2. In the **select** field, enter the name of the application(s) you created and to which you want to assign access. If you want your app’s users to have different roles against the Spatial Anchors account, you should register multiple applications in Azure AD, and assign to each a separate role. Then implement your authorization logic to use the right role for your users.
181180
3. Hit **Save**.
182181
2. In your code (note: you can use the service sample included on GitHub):
183-
1. Make sure to use the application ID, application secret, and redirect Uri of your own Azure AD application as the client ID, secret, and RedirectUri parameters in ADAL
184-
2. Set the tenant ID to your own AAAzure ADD tenant ID in the authority parameter in ADAL
185-
3. On your token request, set the **resource** to "https://sts.mixedreality.azure.com"
182+
1. Make sure to use the application ID, application secret, and redirect Uri of your own Azure AD application as the client ID, secret, and RedirectUri parameters in MSAL
183+
2. Set the tenant ID to your own Azure ADD tenant ID in the authority parameter in MSAL.
184+
3. On your token request, set the **scope** to "https://sts.mixedreality.azure.com//.default"
186185

187186
With that, your backend service can retrieve an Azure AD token. It can then exchange it for an MR token that it will return back to the client. Using an Azure AD token to retrieve an MR token is done via a REST call. Here is a sample call:
188187

189188
```
190-
GET https://mrc-auth-prod.trafficmanager.net/Accounts/35d830cb-f062-4062-9792-d6316039df56/token HTTP/1.1
189+
GET https://sts.mixedreality.azure.com/Accounts/35d830cb-f062-4062-9792-d6316039df56/token HTTP/1.1
191190
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni<truncated>FL8Hq5aaOqZQnJr1koaQ
192-
Host: mrc-auth-prod.trafficmanager.net
191+
Host: sts.mixedreality.azure.com
193192
Connection: Keep-Alive
194193
195194
HTTP/1.1 200 OK
@@ -201,7 +200,7 @@ MS-CV: 05JLqWeKFkWpbdY944yl7A.0
201200
{"AccessToken":"eyJhbG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suXqRgROTzrKqfn_g-qTW4jAKBIXYG7iDefV2rGMRgem06YH_bDnpkgUa1UgJRRTckkBuLkO2FvA"}
202201
```
203202

204-
Where the Authorization header is formatted as follows: `Bearer <accoundId>:<accountKey>`
203+
Where the Authorization header is formatted as follows: `Bearer <Azure_AD_token>`
205204

206205
And the response contains the MR token in plain text.
207206

0 commit comments

Comments
 (0)