From 52bd9b7247956cffc79bf9a7df91b24fb4f86c0b Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Thu, 11 Apr 2024 20:55:08 -0700 Subject: [PATCH] docs: update auth0 docs --- .../docs/en/frameworks/angular/auth0.mdx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/apps/website-new/docs/en/frameworks/angular/auth0.mdx b/apps/website-new/docs/en/frameworks/angular/auth0.mdx index ca124c9f23e..7d3c832eedf 100644 --- a/apps/website-new/docs/en/frameworks/angular/auth0.mdx +++ b/apps/website-new/docs/en/frameworks/angular/auth0.mdx @@ -37,8 +37,7 @@ npm i @auth0/auth0-angular Import the `AuthModule` from `@auth0/auth0-angular` into the AppModule of both the shell application and the micro frontend(s). -```typescript -// In both the shell and micro frontend's app.module.ts files +```typescript title="app.module.ts" import { AuthModule } from '@auth0/auth0-angular'; @@ -61,8 +60,7 @@ Replace `YOUR_AUTH0_DOMAIN` and `YOUR_AUTH0_CLIENT_ID` with the actual values fr In your shell application, use the `AuthService` to implement the login functionality. -```typescript -// projects/shell/src/app/home/home.component.ts +```typescript title="projects/shell/src/app/home/home.component.ts" import { Component } from '@angular/core'; import { AuthService } from '@auth0/auth0-angular'; @@ -87,9 +85,7 @@ export class HomeComponent { In the shell's home component, display the logged-in user's name. -```html - - +```html title="projects/shell/src/app/home/home.component.html"

Welcome!

@@ -105,9 +101,7 @@ In the shell's home component, display the logged-in user's name. In your micro frontend components, you can similarly use `AuthService` to access the current user's information. -```typescript -// Example from a micro frontend's address.component.ts - +```typescript title="address.component.ts" import { AuthService } from '@auth0/auth0-angular'; import { FormBuilder } from '@angular/forms'; import { take } from 'rxjs/operators'; @@ -117,17 +111,14 @@ import { take } from 'rxjs/operators'; }) export class AddressComponent { // component properties... - constructor( private auth: AuthService, private fb: FormBuilder) { - this.auth.user$.pipe(take(1)).subscribe(user => { if (!user) return; // Use user information to pre-fill form, etc. }); } - // other component methods... } ```