Skip to content

Commit 4ad2ff9

Browse files
Merge pull request #100043 from archieag/patch-26
Update JS quickstart steps for ready-to-go downloaded sample
2 parents 68ded6a + 22d434c commit 4ad2ff9

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

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

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ In this quickstart, you use a code sample to learn how a JavaScript single-page
2525
## Prerequisites
2626

2727
* Azure subscription - [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F)
28-
* [Node.js](https://nodejs.org/en/download/).
28+
* [Node.js](https://nodejs.org/en/download/)
2929
* [Visual Studio Code](https://code.visualstudio.com/download) (to edit project files)
3030

31+
3132
> [!div renderon="docs"]
3233
> ## Register and download your quickstart application
3334
> To start your quickstart application, use either of the following options.
@@ -70,38 +71,39 @@ In this quickstart, you use a code sample to learn how a JavaScript single-page
7071
7172
#### Step 2: Download the project
7273

73-
Select the option that's suitable to your development environment:
74+
> [!div renderon="docs"]
75+
> To run the project with a web server by using Node.js, [download the core project files](https://github.com/Azure-Samples/active-directory-javascript-graphapi-v2/archive/quickstart.zip).
7476
75-
* To run the project with a web server by using Node.js, [download the core project files](https://github.com/Azure-Samples/active-directory-javascript-graphapi-v2/archive/quickstart.zip). To open the files, use an editor such as [Visual Studio Code](https://code.visualstudio.com/).
77+
> [!div renderon="portal"]
78+
> Run the project with a web server by using Node.js
7679
77-
#### Step 3: Configure your JavaScript app
80+
> [!div renderon="portal" id="autoupdate" class="nextstepaction"]
81+
> [Download the code sample]()
7882
7983
> [!div renderon="docs"]
84+
> #### Step 3: Configure your JavaScript app
85+
>
8086
> In the *JavaScriptSPA* folder, edit *authConfig.js*, and set the `clientID` and `authority` values under `msalConfig`.
87+
> ```javascript
88+
>
89+
> // Config object to be passed to Msal on creation
90+
> const msalConfig = {
91+
> auth: {
92+
> clientId: "Enter_the_Application_Id_Here",
93+
> authority: "Enter_the_Cloud_Instance_Id_HereEnter_the_Tenant_Info_Here",
94+
> redirectUri: "Enter_the_Redirect_Uri_Here",
95+
> },
96+
> cache: {
97+
> cacheLocation: "sessionStorage", // This configures where your cache will be stored
98+
> storeAuthStateInCookie: false, // Set this to "true" if you are having issues on IE11 or Edge
99+
> forceRefresh: false // Set this to "true" to skip a cached token and go to the server to get a new
100+
> }
101+
> };
102+
> ```
81103
82-
> [!div class="sxs-lookup" renderon="portal"]
83-
> In the *JavaScriptSPA* folder, edit *authConfig.js*, and replace `msalConfig` with the following code:
84-
85-
```javascript
86-
87-
// Config object to be passed to Msal on creation
88-
const msalConfig = {
89-
auth: {
90-
clientId: "Enter_the_Application_Id_Here",
91-
authority: "Enter_the_Cloud_Instance_Id_HereEnter_the_Tenant_Info_Here",
92-
redirectUri: "Enter_the_Redirect_Uri_Here",
93-
},
94-
cache: {
95-
cacheLocation: "sessionStorage", // This configures where your cache will be stored
96-
storeAuthStateInCookie: false, // Set this to "true" if you are having issues on IE11 or Edge
97-
forceRefresh: false // Set this to "true" to skip a cached token and go to the server to get a new
98-
}
99-
};
100-
101-
```
102104
> [!div renderon="portal"]
103105
> > [!NOTE]
104-
> > This quickstart supports Enter_the_Supported_Account_Info_Here.
106+
> > Enter_the_Supported_Account_Info_Here
105107
106108
> [!div renderon="docs"]
107109
>
@@ -116,19 +118,22 @@ Select the option that's suitable to your development environment:
116118
> > [!TIP]
117119
> > To find the values of **Application (client) ID**, **Directory (tenant) ID**, and **Supported account types**, go to the app's **Overview** page in the Azure portal.
118120
>
121+
> [!div class="sxs-lookup" renderon="portal"]
122+
> #### Step 3: Your app is configured and ready to run
123+
> We have configured your project with values of your app's properties.
119124
120-
#### Step 4: Run the project
125+
> [!div renderon="docs"]
126+
> #### Step 4: Run the project
121127
122-
If you're using [Node.js](https://nodejs.org/en/download/):
128+
Run the project with a web server by using [Node.js](https://nodejs.org/en/download/):
123129
124130
1. To start the server, run the following command from the project directory:
125-
126-
```batch
127-
npm install
128-
npm start
129-
```
130-
131+
```batch
132+
npm install
133+
npm start
134+
```
131135
1. Open a web browser and go to `http://localhost:3000/`.
136+
132137
1. Select **Sign In** to start the sign-in, and then call Microsoft Graph API.
133138
134139
After the browser loads the application, select **Sign In**. The first time that you sign in, you're prompted to provide your consent to allow the application to access your profile and to sign you in. After you're signed in successfully, your user profile information should be displayed on the page.

0 commit comments

Comments
 (0)