Skip to content

Commit cda1305

Browse files
committed
ready
1 parent 642fb37 commit cda1305

File tree

8 files changed

+14
-81
lines changed

8 files changed

+14
-81
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ IF SUFFICIENT INFORMATION IS NOT PROVIDED VIA THE FOLLOWING TEMPLATE THE ISSUE M
77
### This issue is for a: (mark with an `x`)
88
```
99
- [ ] bug report -> please search issues before submitting
10+
- [ ] question
1011
- [ ] feature request
1112
- [ ] documentation issue or request
1213
- [ ] regression (a behavior that used to work and stopped in a new release)
@@ -21,8 +22,8 @@ IF SUFFICIENT INFORMATION IS NOT PROVIDED VIA THE FOLLOWING TEMPLATE THE ISSUE M
2122
### Expected/desired behavior
2223
>
2324
24-
### OS and Version?
25-
> Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
25+
### Browser and version?
26+
>
2627
2728
### Versions
2829
>

AppCreationScripts/sample.json

Lines changed: 0 additions & 41 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ description: "This sample demonstrates a JavaScript SPA application calling a No
2121
1. [Running the sample](#running-the-sample)
2222
1. [Explore the sample](#explore-the-sample)
2323
1. [About the code](#about-the-code)
24-
1. [Deployment](#deployment)
2524
1. [More information](#more-information)
2625
1. [Community Help and Support](#community-help-and-support)
2726
1. [Contributing](#contributing)
28-
1. [Code of Conduct](#code-of-conduct)
2927

3028
## Overview
3129

@@ -38,15 +36,15 @@ You will need a **client** application for calling the Web API. Choose:
3836
## Scenario
3937

4038
1. The client application uses the [Microsoft Authentication Library for JavaScript (MSAL.js)](https://github.com/AzureAD/microsoft-authentication-library-for-js) to sign-in a user and obtain a JWT [Access Token](https://docs.microsoft.com/azure/active-directory/develop/access-tokens) from **Azure AD**.
41-
2. The **Access Token** is used as a *bearer* token to authenticate the user when calling this Web API.
39+
1. The **Access Token** is used as a *bearer* token to authenticate the user when calling this web API.
40+
1. The web API responds with the name of the user obtained from the token claims.
4241

4342
![Overview](./ReadmeFiles/topology.png)
4443

4544
## Contents
4645

4746
| File/folder | Description |
4847
|----------------------|-----------------------------------------------------------|
49-
| `AppCreationScripts` | Contains automation scripts for app registration. |
5048
| `config.js` | Contains configuration parameters for the sample. |
5149
| `index.js` | Main application logic resides here. |
5250
| `process.json` | Contains configuration parameters for logging via Morgan. |
@@ -135,9 +133,11 @@ Open the project in your IDE (like Visual Studio or Visual Studio Code) to confi
135133
> In the steps below, "ClientID" is the same as "Application ID" or "AppId".
136134
137135
1. Open the `config.json` file.
138-
1. Find the key `clientID` and replace the existing value with the application ID (clientId) of the `active-directory-b2c-javascript-nodejs-webapi` application copied from the Azure portal.
139-
1. Find the key `tenantID` and replace the existing value with your Azure AD tenant ID.
140-
1. Find the key `audience` and replace the existing value with the application ID (clientId) of the `active-directory-b2c-javascript-nodejs-webapi` application copied from the Azure portal.
136+
1. Find the key `tenantName` and replace the existing value with your **Azure AD** tenant's name e.g. `<your-tenant-name>.onmicrosoft.com`.
137+
1. Find the key `clientID` and replace the existing value with the application ID (clientId) of the `active-directory-b2c-javascript-nodejs-webapi` application copied from the **Azure Portal**.
138+
1. Find the key `audience` and replace the existing value with the application ID (clientId) of the `active-directory-b2c-javascript-nodejs-webapi` application copied from the **Azure Portal**.
139+
1. Find the key `policyName` and replace the existing value with name of the policy you've created, e.g. `B2C_1_SUSI`.
140+
1. Find the key `b2cDomain` and replace the existing value with your tenant Domain name e.g. `<your-tenant-name>.b2clogin.com`.
141141

142142
## Running the sample
143143

@@ -159,6 +159,8 @@ Call this web API from your client application. Upon an authorized call, the web
159159
});
160160
```
161161

162+
![Overview](./ReadmeFiles/screenshot.png)
163+
162164
> :information_source: Did the sample not work for you as expected? Then please reach out to us using the [GitHub Issues](../../../../issues) page.
163165
164166
## About the code
@@ -174,35 +176,6 @@ Call this web API from your client application. Upon an authorized call, the web
174176
);
175177
```
176178
177-
## Deployment
178-
179-
### Deployment to Azure App Services
180-
181-
There is one web project in this sample. To deploy it to **Azure App Services**, you'll need to:
182-
183-
- create an **Azure App Service**
184-
- publish the projects to the **App Services**, and
185-
- update its client(s) to call the web site instead of the local environment.
186-
187-
#### Create and publish `active-directory-b2c-javascript-nodejs-webapi` to an Azure App Services
188-
189-
1. Sign in to the [Azure portal](https://portal.azure.com).
190-
1. Click `Create a resource` in the top left-hand corner, select **Web** --> **Web App**, and give your web site a name, for example, `active-directory-b2c-javascript-nodejs-webapi.azurewebsites.net`.
191-
1. Next, select the `Subscription`, `Resource Group`, `App service plan and Location`. `OS` will be **Windows** and `Publish` will be **Code**.
192-
1. Click `Create` and wait for the App Service to be created.
193-
1. Once you get the `Deployment succeeded` notification, then click on `Go to resource` to navigate to the newly created App service.
194-
1. Once the web site is created, locate it it in the **Dashboard** and click it to open **App Services** **Overview** screen.
195-
196-
> :information_source: If you would like to use **VS Code Azure Tools** extension for deployment, [watch the tutorial](https://docs.microsoft.com/azure/developer/javascript/tutorial-vscode-azure-app-service-node-01) offered by Microsoft Docs.
197-
198-
##### Update the Azure AD B2C app registration for `active-directory-b2c-javascript-nodejs-webapi`
199-
200-
1. Navigate back to to the [Azure portal](https://portal.azure.com).
201-
In the left-hand navigation pane, select the **Azure Active Directory** service, and then select **App registrations (Preview)**.
202-
1. In the resulting screen, select the `active-directory-b2c-javascript-nodejs-webapi` application.
203-
1. From the *Branding* menu, update the **Home page URL**, to the address of your service, for example [https://active-directory-b2c-javascript-nodejs-webapi.azurewebsites.net](https://active-directory-b2c-javascript-nodejs-webapi-contoso.azurewebsites.net). Save the configuration.
204-
1. Add the same URL in the list of values of the *Authentication -> Redirect URIs* menu. If you have multiple redirect URIs, make sure that there a new entry using the App service's URI for each redirect URI.
205-
206179
## More information
207180
208181
- [What is Azure Active Directory B2C?](https://docs.microsoft.com/azure/active-directory-b2c/overview)

ReadmeFiles/screenshot.png

-26.2 KB
Loading
-52.7 KB
Binary file not shown.

ReadmeFiles/topology.png

17.6 KB
Loading

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"credentials": {
3-
"tenantID": "Enter_the_Tenant_ID",
3+
"tenantName": "fabrikamb2c.onmicrosoft.com",
44
"clientID": "93733604-cc77-4a3c-a604-87084dd55348",
55
"audience": "93733604-cc77-4a3c-a604-87084dd55348"
66
},

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const config = require('./config.json');
66
const BearerStrategy = require('passport-azure-ad').BearerStrategy;
77

88
const options = {
9-
identityMetadata: `https://${config.metadata.b2cDomain}/${config.credentials.tenantID}/${config.policies.policyName}/${config.metadata.version}/${config.metadata.discovery}`,
9+
identityMetadata: `https://${config.metadata.b2cDomain}/${config.credentials.tenantName}/${config.policies.policyName}/${config.metadata.version}/${config.metadata.discovery}`,
1010
clientID: config.credentials.clientID,
1111
policyName: config.policies.policyName,
1212
isB2C: config.settings.isB2C,

0 commit comments

Comments
 (0)