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
var clientID ="<your-webapi-application-ID>"; // Application (client) ID
78
78
var b2cDomainHost ="<your-tenant-name>.b2clogin.com";
79
-
var tenantId ="<your-tenant-ID>.onmicrosoft.com";
79
+
var tenantId ="<your-tenant-ID>.onmicrosoft.com";// Alternatively, you can use your Directory (tenant) ID (a GUID)
80
80
var policyName ="B2C_1_signupsignin1";
81
81
```
82
82
83
83
#### Enable CORS
84
84
85
85
To allow your single-page application to call the Node.js web API, you need to enable [CORS](https://expressjs.com/en/resources/middleware/cors.html) in the web API. In a production application you should be careful about which domain is making the request, but for this tutorial, allow requests from any domain.
86
86
87
-
To enable CORS, use the following middleware. In the Node.js web API code sample used inthis tutorial, you can find this code in the *index.js* file.
87
+
To enable CORS, use the following middleware. In the Node.js web API code sample inthis tutorial, it's already been added to the *index.js* file.
88
88
89
89
```javascript
90
90
app.use((req, res, next) => {
@@ -96,9 +96,9 @@ app.use((req, res, next) => {
96
96
97
97
### Configure the single-page application
98
98
99
-
The single-page application (SPA) from the [previous tutorial](tutorial-single-page-app.md) in the series uses Azure ADB2Cfor user sign-up and sign-in, and calls the Node.js web APIprotected by the *frabrikamb2c* demo tenant.
99
+
The single-page application (SPA) from the [previous tutorial](tutorial-single-page-app.md) in the series uses Azure AD B2C for user sign-up and sign-in, and by default, calls the Node.js web API protected by the *frabrikamb2c* demo tenant.
100
100
101
-
In this section, you update the single-page application to call the Node.js web APIprotected by *your* Azure ADB2Ctenant (and which you run on your local machine).
101
+
In this section, you update the single-page web application to call the Node.js web API protected by *your* Azure AD B2C tenant (and which you run on your local machine).
102
102
103
103
To change the settings in the SPA:
104
104
@@ -110,26 +110,26 @@ To change the settings in the SPA:
110
110
The `apiConfig` definition should look similar to the following code block, but with your B2C tenant's name in the place of`<your-tenant-name>`:
111
111
112
112
```javascript
113
+
// The current application coordinates were pre-registered in a B2C tenant.
Finally, you run both the Node.js web API and the sample JavaScript single-page application on your local machine. Then, you sign in to the single-page application and press a button to initiate a request to the protected API.
122
+
You're now ready to test the single-page application's scoped access to the API. Runboth the Node.js web API and the sample JavaScript single-page application on your local machine. Then, sign in to the single-page application and select the **Call API** button to initiate a request to the protectedAPI.
127
123
128
-
Although both applications run locally in this tutorial, they use Azure AD B2C for secure sign-up/sign-in and to grant access to the protected web API.
124
+
Although both applications are running locally when you follow this tutorial, you've configured them to use Azure AD B2C for secure sign-up/sign-in and to grant access to the protected web API.
129
125
130
126
### Run the Node.js web API
131
127
132
-
1. Open a console window and change to the directory containing the Node.js web API sample. For example: `cd active-directory-b2c-javascript-nodejs-webapi`
128
+
1. Open a console window and change to the directory containing the Node.js web API sample. For example:
129
+
130
+
```console
131
+
cd active-directory-b2c-javascript-nodejs-webapi
132
+
```
133
133
134
134
1. Run the following commands:
135
135
@@ -146,7 +146,7 @@ Although both applications run locally in this tutorial, they use Azure AD B2C f
146
146
147
147
### Run the single-page app
148
148
149
-
1. Open a console window and change to the directory containing the JavaScript SPA sample. For example:
149
+
1. Open another console window and change to the directory containing the JavaScript SPA sample. For example:
150
150
151
151
```console
152
152
cd active-directory-b2c-javascript-msal-singlepageapp
0 commit comments