Skip to content

Commit 3e5d73e

Browse files
authored
Merge pull request #43 from Azure-Samples/update-authority-js
Update authority in vanilla and angular
2 parents db8b24a + 24cc1a8 commit 3e5d73e

14 files changed

Lines changed: 80 additions & 79 deletions

File tree

1-Authentication/0-sign-in-vanillajs/App/package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1-Authentication/0-sign-in-vanillajs/App/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"author": "",
1111
"license": "ISC",
1212
"dependencies": {
13-
"@azure/msal-browser": "^2.36.0",
13+
"@azure/msal-browser": "^2.37.0",
1414
"express": "^4.18.2",
1515
"morgan": "^1.10.0"
1616
},

1-Authentication/0-sign-in-vanillajs/App/public/authPopup.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function selectAccount () {
1919
// Add your account choosing logic here
2020
console.warn("Multiple accounts detected.");
2121
} else if (currentAccounts.length === 1) {
22+
username = currentAccounts[0].username
2223
welcomeUser(currentAccounts[0].username);
2324
updateTable(currentAccounts[0]);
2425
}
@@ -32,7 +33,8 @@ function handleResponse(response) {
3233
*/
3334

3435
if (response !== null) {
35-
welcomeUser(response.account.username);
36+
username = response.account.username
37+
welcomeUser(username);
3638
updateTable(response.account);
3739
} else {
3840
selectAccount();

1-Authentication/0-sign-in-vanillajs/App/public/authRedirect.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function selectAccount() {
3030
// Add your account choosing logic here
3131
console.warn("Multiple accounts detected.");
3232
} else if (currentAccounts.length === 1) {
33+
username = currentAccounts[0].username
3334
welcomeUser(currentAccounts[0].username);
3435
updateTable(currentAccounts[0]);
3536
}
@@ -43,7 +44,8 @@ function handleResponse(response) {
4344
*/
4445

4546
if (response !== null) {
46-
welcomeUser(response.account.username);
47+
username = response.account.username
48+
welcomeUser(username);
4749
updateTable(response.account);
4850
} else {
4951
selectAccount();

1-Authentication/0-sign-in-vanillajs/App/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet"
1313
integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
1414

15-
<!-- msal.min.js can be used in the place of msal.js -->
15+
<!-- msal.min.js can be used in the place of msal-browser.js -->
1616
<script src="/msal-browser.min.js"></script>
1717
</head>
1818

1-Authentication/0-sign-in-vanillajs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Open the project in your IDE (like Visual Studio or Visual Studio Code) to confi
163163
164164
1. Open the `App\public\authConfig.js` file.
165165
1. Find the key `Enter_the_Application_Id_Here` and replace the existing value with the application ID (clientId) of `ciam-msal-javascript-spa` app copied from the Azure portal.
166-
1. Find the key `Enter_the_Tenant_Id_Here` and replace the existing value with your Azure AD tenant/directory ID.
166+
1. Find the key `Enter_the_Tenant_Name_Here` and replace the existing value with the name of your Azure AD CIAM tenant.
167167
168168
### Step 4: Running the sample
169169

1-Authentication/2-sign-in-angular/AppCreationScripts/Configure.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ Function ConfigureApplications
251251
# $configFile = $pwd.Path + "\..\SPA\src\app\auth-config.ts"
252252
$configFile = $(Resolve-Path ($pwd.Path + "\..\SPA\src\app\auth-config.ts"))
253253

254-
$dictionary = @{ "Enter_the_Application_Id_Here" = $spaAadApplication.AppId;"Enter_the_Tenant_Info_Here" = $tenantId };
254+
$dictionary = @{ "Enter_the_Application_Id_Here" = $spaAadApplication.AppId;"Enter_the_Tenant_Name_Here" = $tenantName.Split(".onmicrosoft.com")[0] };
255255

256256
Write-Host "Updating the sample config '$configFile' with the following config values:" -ForegroundColor Yellow
257257
$dictionary

1-Authentication/2-sign-in-angular/AppCreationScripts/apps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"settingFile": "/SPA/src/app/auth-config.ts",
3939
"replaceTokens": {
4040
"appId": "Enter_the_Application_Id_Here",
41-
"tenantId": "Enter_the_Tenant_Info_Here"
41+
"tenantName": "Enter_the_Tenant_Name_Here"
4242
}
4343
}
4444
]
Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
---
2-
title: Portal quickstart for Angular SPA
3-
description: This is a portal quickstart for an Angular single-page application
4-
services: active-directory
5-
author: kengaderdus
6-
manager: mwongerapk
7-
ms.author: kengaderdus
8-
ms.service: active-directory
9-
ms.workload: identity
10-
ms.subservice: ciam
11-
ms.topic: quickstart
12-
ms.date: 04/11/2023
2+
title: "Portal quickstart for Angular SPA"
3+
description: Learn how to run an sample Angular single-page application to sign in users
4+
services: active-directory
5+
author: kengaderdus
6+
manager: mwongerapk
7+
ms.author: kengaderdus
8+
ms.service: active-directory
9+
ms.workload: identity
10+
ROBOTS: NOINDEX
11+
ms.subservice: ciam
12+
ms.topic: portal
13+
ms.date: 04/19/2023
1314
---
14-
1515
# Portal quickstart for Angular SPA
1616

17-
> [!div renderon="portal" id="display-on-portal" class="sxs-lookup"]
18-
> In this quickstart, you download and run a code sample that demonstrates how an Angular single-page application (SPA) can sign in users with Azure AD CIAM.
19-
>
20-
> ## Prerequisites
17+
> In this quickstart, you download and run a code sample that demonstrates how an Angular SPA that can sign in users with Azure AD for Customers.
2118
>
22-
> * [Node.js](https://nodejs.org/en/download/)
23-
> * [Visual Studio Code](https://code.visualstudio.com/download) or another code editor
24-
>
25-
> ## Run the sample
19+
> [!div renderon="portal" id="display-on-portal" class="sxs-lookup"]
2620
>
27-
> 1. Unzip the downloaded file.
28-
> 1. Locate the folder in your terminal, then type:
21+
> 1. Make sure you've installed [Node.js](https://nodejs.org/download/).
22+
> 1. Unzip the sample.
23+
> 1. Locate the sample folder in your terminal, then run the following commands:
2924
>
30-
> ```console
31-
> cd SPA
32-
> npm install && npm start
33-
> ```
25+
> ```console
26+
> cd SPA && npm install && npm start
27+
> ```
3428
>
35-
> 1. Open your browser and visit `http://locahost:4200`.
36-
> 1. Select **Sign-in** on the navigation bar.
29+
> 1. Visit `http://locahost:4200` in your browser.
30+
> 1. Select **Sign-in** on the navigation bar, then follow the prompts.
3731
>

1-Authentication/2-sign-in-angular/AppCreationScripts/sample.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"value": ".AppId"
5555
},
5656
{
57-
"key": "Enter_the_Tenant_Info_Here",
58-
"value": "$tenantId"
57+
"key": "Enter_the_Tenant_Name_Here",
58+
"value": "$tenantName"
5959
}
6060
]
6161
}

0 commit comments

Comments
 (0)