Tutorial Native Authentication Single Page App Angular Sign In
In brief
The documentation page for signing users into an Angular SPA with the native authentication JavaScript SDK was deleted.
What Entra admins need to know
No administrator action is indicated. Teams relying on this tutorial may need to update bookmarks or internal guidance.
This editorial summary was generated by AI from the documentation changes. Verify important details in the full Microsoft Learn article.
Documentation change
The comparison below shows only the changed extract. Use the full-page view for complete context.
deleted file mode 100644
title: Sign In Users in Angular SPA by Using Native Authentication JavaScript SDK
description: Learn how to build Angular single-page app that signs in users into an external tenant by using native authentication JavaScript SDK.
manager: dougeby
ms.service: identity-platform
ms.subservice: external
ms.topic: tutorial
ms.date: 11/18/2025
ai-usage: ai-assisted
#Customer intent: As a developer, I want to build an Angular single-page application that uses native authentication JavaScript SDK so that I can sign in users with a username (email or alias) and password or email with one-time passcode.
Tutorial: Sign in users in Angular SPA by using native authentication JavaScript SDK
[!INCLUDE applies-to-external-only]
In this tutorial, you learn how to sign in users into an Angular single-page app (SPA) by using native authentication JavaScript SDK.
In this tutorial, you:
[!div class="checklist"]
Update Angular app to sign in users.Test the sign-in flow.
Prerequisites
Complete the steps in Sign up users into Angular single-page app by using native authentication JavaScript SDK.
Create a sign-in component
Use Angular CLI to generate a new component for sign-in page inside thecomponentsfolder by running the following command:cd components ng generate component sign-inOpen thesign-in/sign-in.component.tsfile and replace its contents with content from sign-in.component.tsOpen thesign-in/sign-in.component.htmlfile and add the contents from sign-in.component.html.The following logic insign-in.component.tsdetermines the next step after the initial sign-in attempt. Depending on the result, it displays either the password or one-time code form insign-in.component.htmlto guide the user through the appropriate part of the sign-in process:const result: SignInResult = await client.signIn({ username: this.username }); if (result.isPasswordRequired()) { this.showPassword = true; this.showCode = false; } else if (result.isCodeRequired()) { this.showPassword = false; this.showCode = true; } else if (result.isCompleted()) { this.isSignedIn = true; this.userData = result.data; }The SDK's instance method,signIn()starts the sign-in flow.
- In the *sign-in.component.html* file:
```html
<form *ngIf="showPassword" (ngSubmit)="submitPassword()">
<input type="password" [(ngModel)]="password" name="password" placeholder="Password" required />
<button type="submit" [disabled]="loading">{{ loading ? 'Verifying...' : 'Submit Password' }}</button>
</form>
<form *ngIf="showCode" (ngSubmit)="submitCode()">
<input type="text" [(ngModel)]="code" name="code" placeholder="OTP Code" required />
<button type="submit" [disabled]="loading">{{ loading ? 'Verifying...' : 'Submit Code' }}</button>
</form>
```
Update the routing module
Open the src/app/app.routes.ts file, then add the route for the sign-in component:
import { SignInComponent } from './components/sign-in/sign-in.component';
export const routes: Routes = [
...
{ path: 'sign-in', component: SignInComponent },
];
Test the sign-in functionality
To start the CORS proxy server, run the following command in your terminal:npm run corsTo start the Angular app, open another terminal window, then run the following command:npm startOpen a web browser and navigate tohttp://localhost:4200/sign-in. A sign-in form appears.To sign in into an existing account, input your details, select the Sign In button, then follow the prompts.
Next step
[!div class="nextstepaction"] Tutorial: Reset password in Angular single-page app by using native authentication JavaScript SDK\ No newline at end of file
@@ -1,115 +0,0 @@-----title: Sign In Users in Angular SPA by Using Native Authentication JavaScript SDK-description: Learn how to build Angular single-page app that signs in users into an external tenant by using native authentication JavaScript SDK.--manager: dougeby-ms.service: identity-platform-ms.subservice: external-ms.topic: tutorial-ms.date: 11/18/2025-ai-usage: ai-assisted-#Customer intent: As a developer, I want to build an Angular single-page application that uses native authentication JavaScript SDK so that I can sign in users with a username (email or alias) and password or email with one-time passcode.------# Tutorial: Sign in users in Angular SPA by using native authentication JavaScript SDK--[!INCLUDE [applies-to-external-only](../external-id/includes/applies-to-external-only.md)]--In this tutorial, you learn how to sign in users into an Angular single-page app (SPA) by using native authentication JavaScript SDK. --In this tutorial, you:-->[!div class="checklist"]->-> - Update Angular app to sign in users.-> - Test the sign-in flow.--## Prerequisites--- Complete the steps in [Sign up users into Angular single-page app by using native authentication JavaScript SDK](tutorial-native-authentication-single-page-app-angular-sign-up.md).--## Create a sign-in component--1. Use Angular CLI to generate a new component for sign-in page inside the *components* folder by running the following command:-- ```console- cd components- ng generate component sign-in- ```--1. Open the *sign-in/sign-in.component.ts* file and replace its contents with content from [sign-in.component.ts](https://github.com/Azure-Samples/ms-identity-ciam-native-javascript-samples/blob/main/typescript/native-auth/angular-sample/src/app/components/sign-in/sign-in.component.ts)--1. Open the *sign-in/sign-in.component.html* file and add the contents from [sign-in.component.html](https://github.com/Azure-Samples/ms-identity-ciam-native-javascript-samples/blob/main/typescript/native-auth/angular-sample/src/app/components/sign-in/sign-in.component.html).-- - The following logic in *sign-in.component.ts* determines the next step after the initial sign-in attempt. Depending on the result, it displays either the password or one-time code form in *sign-in.component.html* to guide the user through the appropriate part of the sign-in process: -- ```typescript- const result: SignInResult = await client.signIn({ username: this.username });- - if (result.isPasswordRequired()) {- this.showPassword = true;- this.showCode = false;- } else if (result.isCodeRequired()) {- this.showPassword = false;- this.showCode = true;- } else if (result.isCompleted()) {- this.isSignedIn = true;- this.userData = result.data;- }- ```- - The SDK's instance method, `signIn()` starts the sign-in flow.-- > [!NOTE]- > The `username` parameter accepts either the user's email address or their username (alias) when the **Username** built-in user attribute is enabled in your tenant's user flow. The user can input either value to sign in. To enable the attribute, see [Enable username in the sign-in identifier policy](../external-id/customers/how-to-sign-in-alias.md#enable-username-in-sign-in-identifier-policy).-- - In the *sign-in.component.html* file:-- ```html- <form *ngIf="showPassword" (ngSubmit)="submitPassword()">- <input type="password" [(ngModel)]="password" name="password" placeholder="Password" required />- <button type="submit" [disabled]="loading">{{ loading ? 'Verifying...' : 'Submit Password' }}</button>- </form>- <form *ngIf="showCode" (ngSubmit)="submitCode()">- <input type="text" [(ngModel)]="code" name="code" placeholder="OTP Code" required />- <button type="submit" [disabled]="loading">{{ loading ? 'Verifying...' : 'Submit Code' }}</button>- </form>- ```----## Update the routing module--Open the *src/app/app.routes.ts* file, then add the route for the sign-in component:--```typescript-import { SignInComponent } from './components/sign-in/sign-in.component';--export const routes: Routes = [- ...- { path: 'sign-in', component: SignInComponent },-];-```--## Test the sign-in functionality--1. To start the CORS proxy server, run the following command in your terminal:-- ```console- npm run cors- ```--1. To start the Angular app, open another terminal window, then run the following command:-- ```console- npm start- ```--1. Open a web browser and navigate to `http://localhost:4200/sign-in`. A sign-in form appears.--1. To sign in into an existing account, input your details, select the Sign In button, then follow the prompts.---## Next step--> [!div class="nextstepaction"]-> [Tutorial: Reset password in Angular single-page app by using native authentication JavaScript SDK](tutorial-native-authentication-single-page-app-angular-reset-password.md)\ No newline at end of file 