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
#Customer intent: As an application developer, I want to learn how my Java app can get an access token and call an API that's protected by Microsoft identity platform endpoint using client credentials flow.
Copy file name to clipboardExpand all lines: articles/active-directory/develop/quickstart-v2-nodejs-console.md
+18-76Lines changed: 18 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,8 @@ author: mmacy
7
7
manager: CelesteDG
8
8
ms.service: active-directory
9
9
ms.subservice: develop
10
-
ms.topic: quickstart
11
-
ms.date: 02/17/2021
10
+
ms.topic: portal
11
+
ms.date: 01/10/2022
12
12
ms.author: marsma
13
13
ms.custom: mode-api
14
14
#Customer intent: As an application developer, I want to learn how my Node.js app can get an access token and call an API that is protected by a Microsoft identity platform endpoint using client credentials flow.
@@ -25,83 +25,33 @@ This quickstart uses the [Microsoft Authentication Library for Node.js (MSAL Nod
25
25
*[Node.js](https://nodejs.org/en/download/)
26
26
*[Visual Studio Code](https://code.visualstudio.com/download) or another code editor
27
27
28
-
> [!div renderon="docs"]
29
-
> ## Register and download the sample application
30
-
>
31
-
> Follow the steps below to get started.
32
-
>
33
-
> [!div renderon="docs"]
34
-
> #### Step 1: Register the application
35
-
> To register your application and add the app's registration information to your solution manually, follow these steps:
36
-
>
37
-
> 1. Sign in to the <ahref="https://portal.azure.com/"target="_blank">Azure portal</a>.
38
-
> 1. If you have access to multiple tenants, use the **Directories + subscriptions** filter :::image type="icon" source="./media/common/portal-directory-subscription-filter.png" border="false"::: in the top menu to switch to the tenant in which you want to register the application.
39
-
> 1. Search for and select **Azure Active Directory**.
40
-
> 1. Under **Manage**, select **App registrations** > **New registration**.
41
-
> 1. Enter a **Name** for your application, for example `msal-node-cli`. Users of your app might see this name, and you can change it later.
42
-
> 1. Select **Register**.
43
-
> 1. Under **Manage**, select **Certificates & secrets**.
44
-
> 1. Under **Client secrets**, select **New client secret**, enter a name, and then select **Add**. Record the secret value in a safe location for use in a later step.
45
-
> 1. Under **Manage**, select **API Permissions** > **Add a permission**. Select **Microsoft Graph**.
46
-
> 1. Select **Application permissions**.
47
-
> 1. Under **User** node, select **User.Read.All**, then select **Add permissions**.
48
-
49
-
> [!div class="sxs-lookup" renderon="portal"]
50
-
> ### Download and configure the sample app
51
-
>
52
-
> #### Step 1: Configure the application in Azure portal
53
-
> For the code sample for this quickstart to work, you need to create a client secret, and add Graph API's **User.Read.All** application permission.
>  Your application is configured with these attributes.
38
+
39
+
#### Step 2: Download the Node.js sample project
40
+
41
+
> [!div class="sxs-lookup nextstepaction"]
66
42
> [Download the code sample](https://github.com/azure-samples/ms-identity-javascript-nodejs-console/archive/main.zip)
67
43
68
-
> [!div class="sxs-lookup" renderon="portal"]
44
+
> [!div class="sxs-lookup"]
69
45
> > [!NOTE]
70
46
> > `Enter_the_Supported_Account_Info_Here`
71
47
72
-
> [!div renderon="docs"]
73
-
> #### Step 3: Configure the Node.js sample project
74
-
>
75
-
> 1. Extract the zip file to a local folder close to the root of the disk, for example, *C:/Azure-Samples*.
76
-
> 1. Edit *.env* and replace the values of the fields `TENANT_ID`, `CLIENT_ID`, and `CLIENT_SECRET` with the following snippet:
77
-
>
78
-
> ```
79
-
> "TENANT_ID": "Enter_the_Tenant_Id_Here",
80
-
> "CLIENT_ID": "Enter_the_Application_Id_Here",
81
-
> "CLIENT_SECRET": "Enter_the_Client_Secret_Here"
82
-
> ```
83
-
> Where:
84
-
> - `Enter_the_Application_Id_Here` - is the **Application (client) ID** of the application you registered earlier. Find this ID on the app registration's **Overview** pane in the Azure portal.
85
-
> - `Enter_the_Tenant_Id_Here` - replace this value with the **Tenant ID** or **Tenant name** (for example, contoso.microsoft.com). Find these values on the app registration's **Overview** pane in the Azure portal.
86
-
> - `Enter_the_Client_Secret_Here` - replace this value with the client secret you created earlier. To generate a new key, use **Certificates & secrets** in the app registration settings in the Azure portal.
87
-
>
88
-
> > [!WARNING]
89
-
> > Any plaintext secret in source code poses an increased security risk. This article uses a plaintext client secret for simplicity only. Use [certificate credentials](active-directory-certificate-credentials.md) instead of client secrets in your confidential client applications, especially those apps you intend to deploy to production.
90
-
91
-
> [!div class="sxs-lookup" renderon="portal"]
92
-
> #### Step 3: Admin consent
93
-
94
-
> [!div renderon="docs"]
95
-
> #### Step 4: Admin consent
48
+
#### Step 3: Admin consent
96
49
97
50
If you try to run the application at this point, you'll receive *HTTP 403 - Forbidden* error: `Insufficient privileges to complete the operation`. This error happens because any *app-only permission* requires **admin consent**: a global administrator of your directory must give consent to your application. Select one of the options below depending on your role:
98
51
99
52
##### Global tenant administrator
100
53
101
-
> [!div renderon="docs"]
102
-
> If you are a global tenant administrator, go to **API Permissions** page in the Azure portal's Application Registration and select **Grant admin consent for {Tenant Name}** (where {Tenant Name} is the name of your directory).
103
-
104
-
> [!div renderon="portal" class="sxs-lookup"]
54
+
> [!div class="sxs-lookup"]
105
55
> If you are a global administrator, go to **API Permissions** page select **Grant admin consent for Enter_the_Tenant_Name_Here**
106
56
> > [!div id="apipermissionspage"]
107
57
> > [Go to the API Permissions page]()
@@ -114,16 +64,8 @@ If you're a standard user of your tenant, then you need to ask a global administ
>> *`Enter_the_Tenant_Id_Here` - replace this value with the **Tenant Id** or **Tenant name** (for example, contoso.microsoft.com)
120
-
>> *`Enter_the_Application_Id_Here` - is the **Application (client) ID** for the application you registered.
121
-
122
-
> [!div class="sxs-lookup" renderon="portal"]
123
-
> #### Step 4: Run the application
124
-
125
-
> [!div renderon="docs"]
126
-
> #### Step 5: Run the application
67
+
> [!div class="sxs-lookup"]
68
+
#### Step 4: Run the application
127
69
128
70
Locate the sample's root folder (where `package.json` resides) in a command prompt or console. You'll need to install the dependencies of this sample once:
#Customer intent: As an application developer, I want to learn how my Python app can get an access token and call an API that's protected by the Microsoft identity platform using client credentials flow.
0 commit comments