Skip to content

Commit 05f77e8

Browse files
authored
Merge pull request #31 from Azure-Samples/derisen-patch-1
Fix readme inconsistencies
2 parents d1fa173 + cce6417 commit 05f77e8

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ description: "This sample demonstrates a JavaScript SPA application calling a No
2727

2828
## Overview
2929

30-
This sample demonstrates [how to protect a Node.js Web API](https://docs.microsoft.com/azure/active-directory/develop/quickstart-configure-app-expose-web-apis) with [Microsoft identity platform](https://docs.microsoft.com/azure/active-directory/develop/) and [Azure Active Directory (Azure AD)](https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis) using the [passport-azure-ad](https://github.com/AzureAD/passport-azure-ad) library.
30+
This sample demonstrates [how to protect a Node.js Web API](https://docs.microsoft.com/azure/active-directory/develop/quickstart-configure-app-expose-web-apis) with [Microsoft identity platform](https://docs.microsoft.com/azure/active-directory/develop/) and [Azure AD B2C](https://docs.microsoft.com/azure/active-directory-b2c/overview) using the [passport-azure-ad](https://github.com/AzureAD/passport-azure-ad) library.
3131

3232
You will need a **client** application for calling the Web API. Choose:
3333

3434
- [JavaScript Single-page Application calling a custom Web API with MSAL.js 2.x using the auth code flow with PKCE](https://github.com/Azure-Samples/ms-identity-b2c-javascript-spa).
3535

3636
## Scenario
3737

38-
1. The client application uses the [Microsoft Authentication Library for JavaScript (MSAL.js)](https://github.com/AzureAD/microsoft-authentication-library-for-js) to sign-in a user and obtain a JWT [Access Token](https://docs.microsoft.com/azure/active-directory/develop/access-tokens) from **Azure AD**.
38+
1. The client application uses the [Microsoft Authentication Library for JavaScript (MSAL.js)](https://github.com/AzureAD/microsoft-authentication-library-for-js) to sign-in a user and obtain a JWT [Access Token](https://docs.microsoft.com/azure/active-directory/develop/access-tokens) from **Azure AD B2C**.
3939
1. The **Access Token** is used as a *bearer* token to authenticate the user when calling this web API.
4040
1. The web API responds with the name of the user obtained from the token claims.
4141

@@ -108,18 +108,15 @@ Please refer to: [Tutorial: Add identity providers to your applications in Azure
108108
1. Select **Register** to create the application.
109109
1. In the app's registration screen, find and note the **Application (client) ID**. You use this value in your app's configuration file(s) later in your code.
110110
1. Select **Save** to save your changes.
111-
1. In the app's registration screen, select the **Expose an API** blade to the left to open the page where you can declare the parameters to expose this app as an Api for which client applications can obtain [access tokens](https://docs.microsoft.com/azure/active-directory/develop/access-tokens) for.
112-
The first thing that we need to do is to declare the unique [resource](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) URI that the clients will be using to obtain access tokens for this Api. To declare an resource URI, follow the following steps:
111+
1. In the app's registration screen, select the **Expose an API** blade to the left to open the page where you can declare the parameters to expose this app as an API for which client applications can obtain [access tokens](https://docs.microsoft.com/azure/active-directory/develop/access-tokens) for.
112+
The first thing that we need to do is to declare the unique [resource](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) URI that the clients will be using to obtain access tokens for this API. To declare an resource URI, follow the following steps:
113113
- Click `Set` next to the **Application ID URI** to generate a URI that is unique for this app.
114114
- For this sample, accept the proposed Application ID URI (api://{clientId}) by selecting **Save**.
115-
1. All Apis have to publish a minimum of one [scope](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-authorization-code) for the client's to obtain an access token successfully. To publish a scope, follow the following steps:
115+
1. All APIs have to publish a minimum of one [scope](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-authorization-code) for the client's to obtain an access token successfully. To publish a scope, follow the following steps:
116116
- Select **Add a scope** button open the **Add a scope** screen and Enter the values as indicated below:
117117
- For **Scope name**, use `demo.read`.
118-
- Select **Admins and users** options for **Who can consent?**
119118
- For **Admin consent display name** type `Access active-directory-b2c-javascript-nodejs-webapi`
120119
- For **Admin consent description** type `Allows the app to access active-directory-b2c-javascript-nodejs-webapi as the signed-in user.`
121-
- For **User consent display name** type `Access active-directory-b2c-javascript-nodejs-webapi`
122-
- For **User consent description** type `Allow the application to access active-directory-b2c-javascript-nodejs-webapi on your behalf.`
123120
- Keep **State** as **Enabled**
124121
- Click on the **Add scope** button on the bottom to save this scope.
125122
1. On the right side menu, select the `Manifest` blade.
@@ -133,7 +130,7 @@ Open the project in your IDE (like Visual Studio or Visual Studio Code) to confi
133130
> In the steps below, "ClientID" is the same as "Application ID" or "AppId".
134131
135132
1. Open the `config.json` file.
136-
1. Find the key `tenantName` and replace the existing value with your **Azure AD** tenant's name e.g. `fabrikamb2c`.
133+
1. Find the key `tenantName` and replace the existing value with your **Azure AD B2C** tenant's name e.g. `fabrikamb2c`.
137134
1. Find the key `clientID` and replace the existing value with the application ID (clientId) of the `active-directory-b2c-javascript-nodejs-webapi` application copied from the **Azure Portal**.
138135
1. Find the key `policyName` and replace the existing value with name of the policy you've created, e.g. `B2C_1_SUSI`.
139136

@@ -165,7 +162,7 @@ Consider taking a moment to [share your experience with us](https://forms.office
165162
[passport-azure-ad](https://github.com/AzureAD/passport-azure-ad) validates the token against the `issuer`, `scope` and `audience` claims (defined in `BearerStrategy` constructor) using the `passport.authenticate()` API:
166163

167164
```javascript
168-
app.get('/api', passport.authenticate('oauth-bearer', { session: false }),
165+
app.get('/hello', passport.authenticate('oauth-bearer', { session: false }),
169166
(req, res) => {
170167
console.log('Validated claims: ', req.authInfo);
171168
);

0 commit comments

Comments
 (0)