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
Copy file name to clipboardExpand all lines: articles/active-directory-b2c/partner-gallery.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Our ISV partner network extends our solution capabilities to help you build seam
21
21
To be considered into this sample documentation, submit your application request in the [Microsoft Application Network portal](https://microsoft.sharepoint.com/teams/apponboarding/Apps/SitePages/Default.aspx). For any additional questions, send an email to [[email protected]](mailto:[email protected]).
22
22
23
23
>[!NOTE]
24
-
>The [Azure Active Directory B2C community site on GitHub](https://azure-ad-b2c.github.io/azureadb2ccommunity.io/) also provides sample custom policies from the community.
24
+
>The [Azure Active Directory B2C community site on GitHub](https://github.com/azure-ad-b2c/partner-integrations) also provides sample custom policies from the community.
# Customer intent: As an application developer, I want to know how to set up authentication in a web application built using Node.js and MSAL Node.
17
17
---
18
18
19
-
In this quickstart, you download and run a code sample that demonstrates how a Node.js web app can sign in users by using the authorization code flow. The code sample also demonstrates how to get an access token to call Microsoft Graph API.
19
+
In this quickstart, you download and run a code sample that demonstrates how a Node.js web app can sign in users by using the authorization code flow. The code sample also demonstrates how to get an access token to call the Microsoft Graph API.
20
20
21
21
See [How the sample works](#how-the-sample-works) for an illustration.
22
22
@@ -37,8 +37,8 @@ This quickstart uses the Microsoft Authentication Library for Node.js (MSAL Node
37
37
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.
38
38
1. Under **Manage**, select **App registrations** > **New registration**.
39
39
1. Enter a **Name** for your application. Users of your app might see this name, and you can change it later.
40
-
1. Under **Supported account types**, select **Accounts in any organizational directory and personal Microsoft accounts**.
41
-
1. Set the **Redirect URI** value to `http://localhost:3000/redirect`.
40
+
1. Under **Supported account types**, select **Accounts in this organizational directory only**.
41
+
1. Set the **Redirect URI** value to `http://localhost:3000/auth/redirect`.
42
42
1. Select **Register**.
43
43
1. On the app **Overview** page, note the **Application (client) ID** value for later use.
44
44
1. Under **Manage**, select **Certificates & secrets** > **Client secrets** > **New client secret**. Leave the description blank and default expiration, and then select **Add**.
@@ -51,67 +51,57 @@ To run the project with a web server by using Node.js, [download the core projec
51
51
52
52
#### Step 3: Configure your Node app
53
53
54
-
Extract the project, open the *ms-identity-node-main* folder, and then open the *index.js* file.
55
-
56
-
Set the `clientID` value with the application (client) ID, and then set the `clientSecret` value with the client secret.
Extract the project, open the *ms-identity-node-main* folder, and then open the *.env* file under the *App* folder. Replace the values above as follows:
77
55
78
-
Modify the values in the `config` section:
56
+
| Variable | Description | Example(s) |
57
+
|-----------|--------------|------------|
58
+
|`Enter_the_Cloud_Instance_Id_Here`| The Azure cloud instance in which your application is registered |`https://login.microsoftonline.com/` (include the trailing forward-slash) |
59
+
|`Enter_the_Tenant_Info_here`| Tenant ID or Primary domain |`contoso.microsoft.com` or `cbe899ec-5f5c-4efe-b7a0-599505d3d54f`|
60
+
|`Enter_the_Application_Id_Here`| Client ID of the application you registered |`cbe899ec-5f5c-4efe-b7a0-599505d3d54f`|
61
+
|`Enter_the_Client_Secret_Here`| Client secret of the application you registered |`WxvhStRfDXoEiZQj1qCy`|
62
+
|`Enter_the_Graph_Endpoint_Here`| The Microsoft Graph API cloud instance that your app will call |`https://graph.microsoft.com/` (include the trailing forward-slash) |
63
+
|`Enter_the_Express_Session_Secret_Here`| A random string of characters used to sign the Express session cookie |`WxvhStRfDXoEiZQj1qCy`|
79
64
80
-
-`Enter_the_Application_Id_Here` is the application (client) ID for the application you registered.
65
+
Your file should look similar to below:
81
66
82
-
To find the application (client) ID, go to the app registration's **Overview** page in the Azure portal.
83
-
-`Enter_the_Client_Secret_Here` is the client secret for the application you registered.
67
+
```text
68
+
CLOUD_INSTANCE=https://login.microsoftonline.com/
69
+
TENANT_ID=cbe899ec-5f5c-4efe-b7a0-599505d3d54f
70
+
CLIENT_ID=fa29b4c9-7675-4b61-8a0a-bf7b2b4fda91
71
+
CLIENT_SECRET=WxvhStRfDXoEiZQj1qCy
84
72
85
-
To retrieve or generate a new client secret, under **Manage**, select **Certificates & secrets**.
73
+
REDIRECT_URI=http://localhost:3000/auth/redirect
74
+
POST_LOGOUT_REDIRECT_URI=http://localhost:3000
86
75
87
-
The default `authority` value represents the main (global) Azure cloud:
1. To start the server, run the following commands from within the project directory:
98
87
99
88
```console
89
+
cd App
100
90
npm install
101
91
npm start
102
92
```
103
93
104
94
1. Go to `http://localhost:3000/`.
105
95
106
-
1. Select **Sign In** to start the sign-in process.
96
+
1. Select **Sign in** to start the sign-in process.
107
97
108
-
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, you will see a log message in the command line.
98
+
The first time you sign in, you're prompted to provide your consent to allow the application to sign you in and access your profile. After you're signed in successfully, you'll be redirected back to the application home page.
109
99
110
100
## More information
111
101
112
102
### How the sample works
113
103
114
-
The sample hosts a web server on localhost, port 3000. When a web browser accesses this site, the sample immediately redirects the user to a Microsoft authentication page. Because of this, the sample does not contain any HTML or display elements. Authentication success displays the message "OK".
104
+
The sample hosts a web server on localhost, port 3000. When a web browser accesses this address, the app renders the home page. Once the user selects **Sign in**, the app redirects the browser to Azure AD sign-in screen, via the URL generated by the MSAL Node library. After user consents, the browser redirects the user back to the application home page, along with an ID and access token.
115
105
116
106
### MSAL Node
117
107
@@ -123,5 +113,6 @@ npm install @azure/msal-node
123
113
124
114
## Next steps
125
115
116
+
Learn more about the web app scenario that the Microsoft identity platform supports:
126
117
> [!div class="nextstepaction"]
127
-
> [Adding Auth to an existing web app - GitHub code sample >](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/auth-code)
118
+
> [Web app that signs in users scenario](../../scenario-web-app-sign-user-overview.md)
0 commit comments