Skip to content

Commit e789351

Browse files
authored
Merge pull request #152387 from v-andreaco/1828798-javascript
edit pass: quickstart-v2-javascript-auth-code
2 parents 07a4ae7 + e7e9b3b commit e789351

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

articles/active-directory/develop/quickstart-v2-javascript-auth-code.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ ms.custom: aaddev, scenarios:getting-started, languages:JavaScript, devx-track-j
1616
#Customer intent: As an app developer, I want to learn how to get access tokens and refresh tokens by using the Microsoft identity platform so that my JavaScript app can sign in users of personal accounts, work accounts, and school accounts.
1717
---
1818

19-
# Quickstart: Sign in users and get an access token in a JavaScript SPA using the auth code flow with PKCE
19+
# Quickstart: Sign in users and get an access token in a JavaScript SPA using the auth code flow with PKCE
2020

21-
In this quickstart, you download and run a code sample that demonstrates how a JavaScript single-page application (SPA) can sign in users and call Microsoft Graph using the authorization code flow with Proof Key for Code Exchange (PKCE). The code sample demonstrates how to get an access token to call the Microsoft Graph API or any web API.
21+
In this quickstart, you download and run a code sample that demonstrates how a JavaScript single-page application (SPA) can sign in users and call Microsoft Graph using the authorization code flow with Proof Key for Code Exchange (PKCE). The code sample demonstrates how to get an access token to call the Microsoft Graph API or any web API.
2222

2323
See [How the sample works](#how-the-sample-works) for an illustration.
2424

@@ -81,10 +81,10 @@ This quickstart uses MSAL.js v2 with the authorization code flow. For a similar
8181
> [!div renderon="docs"]
8282
> #### Step 3: Configure your JavaScript app
8383
>
84-
> In the *app* folder, open the *authConfig.js* file and update the `clientID`, `authority`, and `redirectUri` values in the `msalConfig` object.
84+
> In the *app* folder, open the *authConfig.js* file, and then update the `clientID`, `authority`, and `redirectUri` values in the `msalConfig` object.
8585
>
8686
> ```javascript
87-
> // Config object to be passed to Msal on creation
87+
> // Config object to be passed to MSAL on creation
8888
> const msalConfig = {
8989
> auth: {
9090
> clientId: "Enter_the_Application_Id_Here",
@@ -104,13 +104,13 @@ This quickstart uses MSAL.js v2 with the authorization code flow. For a similar
104104
105105
> [!div renderon="docs"]
106106
>
107-
> Modify the values in the `msalConfig` section as described here:
107+
> Modify the values in the `msalConfig` section:
108108
>
109109
> - `Enter_the_Application_Id_Here` is the **Application (client) ID** for the application you registered.
110110
>
111111
> To find the value of **Application (client) ID**, go to the app registration's **Overview** page in the Azure portal.
112-
> - `Enter_the_Cloud_Instance_Id_Here` is the instance of the Azure cloud. For the main or global Azure cloud, enter `https://login.microsoftonline.com/`. For **national** clouds (for example, China), see [National clouds](authentication-national-cloud.md).
113-
> - `Enter_the_Tenant_info_here` is set to one of the following:
112+
> - `Enter_the_Cloud_Instance_Id_Here` is the Azure cloud instance. For the main or global Azure cloud, enter `https://login.microsoftonline.com/`. For **national** clouds (for example, China), see [National clouds](authentication-national-cloud.md).
113+
> - `Enter_the_Tenant_info_here` is one of the following:
114114
> - If your application supports *accounts in this organizational directory*, replace this value with the **Tenant ID** or **Tenant name**. For example, `contoso.microsoft.com`.
115115
>
116116
> To find the value of the **Directory (tenant) ID**, go to the app registration's **Overview** page in the Azure portal.
@@ -130,11 +130,12 @@ This quickstart uses MSAL.js v2 with the authorization code flow. For a similar
130130
131131
> [!div class="sxs-lookup" renderon="portal"]
132132
> #### Step 3: Your app is configured and ready to run
133+
>
133134
> We have configured your project with values of your app's properties.
134135
135136
> [!div renderon="docs"]
136137
>
137-
> Then, still in the same folder, edit the *graphConfig.js* file and update the `graphMeEndpoint` and `graphMailEndpoint` values in the `apiConfig` object.
138+
> Next, open the *graphConfig.js* file to update the `graphMeEndpoint` and `graphMailEndpoint` values in the `apiConfig` object.
138139
>
139140
> ```javascript
140141
> // Add here the endpoints for MS Graph API services you would like to use.
@@ -151,9 +152,9 @@ This quickstart uses MSAL.js v2 with the authorization code flow. For a similar
151152
>
152153
> [!div renderon="docs"]
153154
>
154-
> `Enter_the_Graph_Endpoint_Here` is the endpoint that API calls will be made against. For the main (global) Microsoft Graph API service, enter `https://graph.microsoft.com/` (include the trailing forward-slash). For more information about Microsoft Graph on national clouds, see [National cloud deployment](/graph/deployments).
155+
> `Enter_the_Graph_Endpoint_Here` is the endpoint that API calls are made against. For the main (global) Microsoft Graph API service, enter `https://graph.microsoft.com/` (include the trailing forward-slash). For more information about Microsoft Graph on national clouds, see [National cloud deployment](/graph/deployments).
155156
>
156-
> The `graphMeEndpoint` and `graphMailEndpoint` values in the *graphConfig.js* file should be similar to the following if you're using the main (global) Microsoft Graph API service:
157+
> If you're using the main (global) Microsoft Graph API service, the `graphMeEndpoint` and `graphMailEndpoint` values in the *graphConfig.js* file should be similar to the following:
157158
>
158159
> ```javascript
159160
> graphMeEndpoint: "https://graph.microsoft.com/v1.0/me",
@@ -162,26 +163,28 @@ This quickstart uses MSAL.js v2 with the authorization code flow. For a similar
162163
>
163164
> #### Step 4: Run the project
164165
165-
Run the project with a web server by using Node.js:
166+
Run the project with a web server by using Node.js.
166167
167168
1. To start the server, run the following commands from within the project directory:
169+
168170
```console
169171
npm install
170172
npm start
171173
```
172-
1. Browse to `http://localhost:3000/`.
174+
175+
1. Go to `http://localhost:3000/`.
173176
174177
1. Select **Sign In** to start the sign-in process and then call the Microsoft Graph API.
175178
176-
The first time you sign in, you're prompted to provide your consent to allow the application to access your profile and sign you in. After you're signed in successfully, your user profile information should be displayed on the page.
179+
The first time you sign in, you're prompted to provide your consent to allow the application to access your profile and sign you in. After you're signed in successfully, your user profile information is displayed on the page.
177180
178181
## More information
179182
180183
### How the sample works
181184
182185
![Diagram showing the authorization code flow for a single-page application.](media/quickstart-v2-javascript-auth-code/diagram-01-auth-code-flow.png)
183186
184-
### msal.js
187+
### MSAL.js
185188
186189
The MSAL.js library signs in users and requests the tokens that are used to access an API that's protected by Microsoft identity platform. The sample's *index.html* file contains a reference to the library:
187190

0 commit comments

Comments
 (0)