Skip to content

Commit 73178c8

Browse files
committed
minor update
1 parent 4e10c7b commit 73178c8

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

articles/active-directory-b2c/enable-authentication-in-node-web-app-with-api-options.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Before you start, it's important to familiarize yourself with the following arti
2626

2727
To use a custom domain and your tenant ID in the authentication URL, follow the guidance in [Enable custom domains](custom-domain.md). Under the project root folder, open the *.env* file. This file contains information about your Azure AD B2C identity provider.
2828

29-
In the *.env* file, do the following:
29+
In the `.env` file of your web app, do the following:
3030

3131
- Replace all instances of `tenant-name.b2clogin.com` with your custom domain. For example, replace `tenant-name.b2clogin.com`, to `login.contoso.com`.
3232
- Replace all instances of `tenant-name.onmicrosoft.com` with your [tenant ID](tenant-management.md#get-your-tenant-id). For more information, see [Use tenant ID](custom-domain.md#optional-use-tenant-id).
@@ -57,6 +57,32 @@ APP_REDIRECT_URI=http://localhost:3000/redirect
5757
LOGOUT_ENDPOINT=https://login.contoso.com/12345678-0000-0000-0000-000000000000/B2C_1_susi/oauth2/v2.0/logout?post_logout_redirect_uri=http://localhost:3000
5858
```
5959

60+
In the `index.js` file of your web API, do the following:
61+
62+
- Replace all instances of `tenant-name.b2clogin.com` with your custom domain. For example, replace `tenant-name.b2clogin.com`, to `login.contoso.com`.
63+
64+
- Replace all instances of `tenant-name.onmicrosoft.com` with your [tenant ID](tenant-management.md#get-your-tenant-id). For more information, see [Use tenant ID](custom-domain.md#optional-use-tenant-id).
65+
66+
The following configuration shows the app settings before the change:
67+
68+
```javascript
69+
const options = {
70+
identityMetadata: `https://${config.credentials.tenantName}.b2clogin.com/${config.credentials.tenantName}.onmicrosoft.com/${config.policies.policyName}/${config.metadata.version}/${config.metadata.discovery}`,
71+
clientID: config.credentials.clientID,
72+
......
73+
}
74+
```
75+
76+
The following configuration shows the app settings after the change:
77+
78+
```javascript
79+
const options = {
80+
identityMetadata: `https://login.contoso.com/12345678-0000-0000-0000-000000000000/${config.policies.policyName}/${config.metadata.version}/${config.metadata.discovery}`,
81+
clientID: config.credentials.clientID,
82+
......
83+
}
84+
```
85+
6086
[!INCLUDE [active-directory-b2c-app-integration-login-hint](../../includes/active-directory-b2c-app-integration-login-hint.md)]
6187

6288
1. If you're using a custom policy, add the required input claim, as described in [Set up direct sign-in](direct-signin.md#prepopulate-the-sign-in-name).

0 commit comments

Comments
 (0)