You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 3, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: 6-AdvancedScenarios/1-call-api-obo/README.md
+18-42
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,11 @@ page_type: sample
3
3
name: Authenticate a user with Azure AD using msal.js and call an Azure AD protected Node.js Web Api using on-behalf of flow
4
4
description: Handling Conditional Access challenges in an Azure AD protected Node.js web API calling another protected Node.js web API on behalf of a user using the on-behalf of flow
@@ -42,7 +42,7 @@ This sample demonstrates a React single-page application (SPA) which lets a user
42
42
43
43
1. The client app uses **MSAL React** to sign-in a user and obtain a **JWT**[Access Token](https://aka.ms/access-tokens) from **Azure AD** for the **API**.
44
44
1. The access token is used as a *bearer token* to authorize the user to call the Node.js **API** protected by **Azure AD**.
45
-
1. This access token is also used by the Node.js API to obtain another Access token to call the MS Graph API **on user's behalf** using the [OAuth 2.0 on-behalf-of flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow).
45
+
1. This access token is also used by the Node.js API to obtain another Access token to call the MS Graph API **on user's behalf** using the [OAuth 2.0 on-behalf-of flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow).
46
46
1. The Node.js **API** uses the [Microsoft Graph SDK](https://docs.microsoft.com/graph/sdks/sdks-overview) to call MS Graph
47
47
48
48

@@ -54,7 +54,7 @@ This sample demonstrates a React single-page application (SPA) which lets a user
54
54
|`AppCreationScripts/`| Contains Powershell scripts to automate app registration. |
55
55
|`SPA/src/authConfig.js`| Contains configuration parameters for the SPA. |
56
56
|`API/authConfig.json`| Contains authentication parameters for the API. |
57
-
|`API/MsalOnBehalfOfClient.js`| Contains the logic to Acquire an access token for Graph API using OBO flow. |
57
+
|`API/auth/onBehalfOfClient.js`| Contains logic to acquire an access token for Graph API using OBO flow. |
58
58
59
59
## Prerequisites
60
60
@@ -119,7 +119,7 @@ There are two projects in this sample. Each needs to be separately registered in
119
119
```PowerShell
120
120
cd .\AppCreationScripts\
121
121
.\Configure.ps1 -TenantId "[Optional] - your tenant id" -AzureEnvironmentName "[Optional] - Azure environment, defaults to 'Global'"
122
-
```
122
+
```
123
123
124
124
> Other ways of running the scripts are described in [App Creation Scripts guide](./AppCreationScripts/AppCreationScripts.md). The scripts also provide a guide to automated application registration, configuration and removal which can help in your CI/CD scenarios.
125
125
@@ -189,19 +189,18 @@ To manually register the apps, as a first step you'll need to:
189
189
1. Set the **optionalClaims** property as shown below to request client capabilities claim *xms_cc*:
190
190
191
191
```json
192
-
"optionalClaims":
193
-
{
194
-
"accessToken": [
195
-
{
196
-
"additionalProperties": [],
197
-
"essential": false,
198
-
"name": "xms_cc",
199
-
"source": null
200
-
}
201
-
],
202
-
"idToken": [],
203
-
"saml2Token": []
204
-
}
192
+
"optionalClaims": {
193
+
"accessToken": [
194
+
{
195
+
"additionalProperties": [],
196
+
"essential": false,
197
+
"name": "xms_cc",
198
+
"source": null
199
+
}
200
+
],
201
+
"idToken": [],
202
+
"saml2Token": []
203
+
}
205
204
```
206
205
207
206
##### Configure the service app (msal-node-api) to use your app registration
@@ -319,32 +318,9 @@ The middle-tier application adds the client to the `knownClientApplications` lis
319
318
320
319
### Acquire an access token with the OBO flow
321
320
322
-
To get the access token for Graph API using the OBO flow, the middle-tier web API will initialize a **ConfidentialClientApplication** to exchange the access token using the **acquireTokenOnBehalfOf** API to get a new access token for the down-stream resource in the case Graph API.
321
+
To get the access token for Graph API using the OBO flow, the middle-tier web API will initialize a **ConfidentialClientApplication** to exchange the access token using the **acquireTokenOnBehalfOf** API to get a new access token for the down-stream resource in the case Graph API. This is shown in [onBehalfOfClient.js](./API/auth/onBehalfOfClient.js):
0 commit comments