Skip to content

Commit 3abe10f

Browse files
authored
Merge pull request #249210 from cilwerner/cilwerner-patch-1-1
Removing secret reference lines in code snippets
2 parents 355a3a4 + 97f733c commit 3abe10f

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

articles/active-directory/external-identities/customers/how-to-web-app-node-use-certificate.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ ms.custom: developer, devx-track-js
1919

2020
Azure Active Directory (Azure AD) for customers supports two types of authentication for [confidential client applications](../../../active-directory/develop/msal-client-applications.md); password-based authentication (such as client secret) and certificate-based authentication. For a higher level of security, we recommend using a certificate (instead of a client secret) as a credential in your confidential client applications.
2121

22-
In production, you should purchase a certificate signed by a well-known certificate authority, and use [Azure Key Vault](https://azure.microsoft.com/products/key-vault/) to manage certificate access and lifetime for you. However, for testing purposes, you can create a self-signed certificate and configure your apps to authenticate with it.
22+
In production, you should purchase a certificate signed by a well-known certificate authority, and use [Azure Key Vault](https://azure.microsoft.com/products/key-vault/) to manage certificate access and lifetime for you. However, for testing purposes, you can create a self-signed certificate and configure your apps to authenticate with it.
2323

24-
In this article, you learn to generate a self-signed certificate by using [Azure Key Vault](https://azure.microsoft.com/products/key-vault/) on the Azure portal, OpenSSL or Windows PowerShell.
24+
In this article, you learn to generate a self-signed certificate by using [Azure Key Vault](https://azure.microsoft.com/products/key-vault/) on the Azure portal, OpenSSL or Windows PowerShell. If you have a client secret already, you'll learn how to safely delete it.
2525

2626
When needed, you can also create a self-signed certificate programmatically by using [.NET](/azure/key-vault/certificates/quick-create-net), [Node.js](/azure/key-vault/certificates/quick-create-node), [Go](/azure/key-vault/certificates/quick-create-go), [Python](/azure/key-vault/certificates/quick-create-python) or [Java](/azure/key-vault/certificates/quick-create-java) client libraries.
2727

@@ -88,11 +88,13 @@ After the command finishes execution, you should have a *.crt* and a *.key* file
8888

8989
[!INCLUDE [active-directory-customers-app-integration-add-user-flow](./includes/register-app/add-client-app-certificate.md)]
9090

91+
[!INCLUDE [remove-client-secret](./includes/remove-client-secret.md)]
92+
9193
## Configure your Node.js app to use certificate
9294

9395
Once you associate your app registration with the certificate, you need to update your app code to start using the certificate:
9496

95-
1. Locate the file that contains your MSAL configuration object, such as `msalConfig` in *authConfig.js*, then update it to look similar to the following code:
97+
1. Locate the file that contains your MSAL configuration object, such as `msalConfig` in *authConfig.js*, then update it to look similar to the following code. If you have a client secret present, make sure you remove it:
9698

9799
```javascript
98100
require('dotenv').config();
@@ -124,7 +126,6 @@ Once you associate your app registration with the certificate, you need to updat
124126
auth: {
125127
clientId: process.env.CLIENT_ID || 'Enter_the_Application_Id_Here', // 'Application (client) ID' of app registration in Azure portal - this value is a GUID
126128
authority: process.env.AUTHORITY || `https://${TENANT_SUBDOMAIN}.ciamlogin.com/`,
127-
//clientSecret: process.env.CLIENT_SECRET || 'Enter_the_Client_Secret_Here', // Client secret generated from the app registration in Azure portal
128129
clientCertificate: {
129130
thumbprint: "YOUR_CERT_THUMBPRINT", // replace with thumbprint obtained during step 2 above
130131
privateKey: privateKey
@@ -174,14 +175,13 @@ Once you associate your app registration with the certificate, you need to updat
174175
175176
You can use your existing certificate directly from Azure Key Vault:
176177
177-
1. Locate the file that contains your MSAL configuration object, such as `msalConfig` in *authConfig.js*, then comment the `clientSecret` property:
178+
1. Locate the file that contains your MSAL configuration object, such as `msalConfig` in *authConfig.js*, then remove the `clientSecret` property:
178179
179180
```java
180181
const msalConfig = {
181182
auth: {
182183
clientId: process.env.CLIENT_ID || 'Enter_the_Application_Id_Here', // 'Application (client) ID' of app registration in Azure portal - this value is a GUID
183184
authority: process.env.AUTHORITY || `https://${TENANT_SUBDOMAIN}.ciamlogin.com/`,
184-
//clientSecret: process.env.CLIENT_SECRET || 'Enter_the_Client_Secret_Here', // Client secret generated from the app registration in Azure portal
185185
},
186186
//...
187187
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
author: cilwerner
3+
ms.service: active-directory
4+
ms.subservice: ciam
5+
ms.topic: include
6+
ms.date: 08/28/2023
7+
ms.author: cwerner
8+
---
9+
10+
If you've a client secret already in place for your application, you need to delete it to avoid a malicious application for impersonating your application:
11+
12+
1. Go to the **Client secrets** tab, and select the **Delete** icon.
13+
2. In the pop-up window that appears, select **Yes**.

0 commit comments

Comments
 (0)