MCPcopy Create free account
hub / github.com/auth0-samples/auth0-ionic-samples / AppComponent

Class AppComponent

angular/src/app/app.component.ts:14–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12 styleUrls: ['app.component.scss'],
13})
14export class AppComponent implements OnInit {
15 constructor(public auth: AuthService, private ngZone: NgZone) {}
16
17 ngOnInit(): void {
18 App.addListener('appUrlOpen', ({ url }) => {
19 // Must run inside an NgZone for Angular to pick up the changes
20 // https://capacitorjs.com/docs/guides/angular
21 this.ngZone.run(() => {
22 if (url?.startsWith(callbackUri)) {
23 if (
24 url.includes('state=') &&
25 (url.includes('error=') || url.includes('code='))
26 ) {
27 this.auth
28 .handleRedirectCallback(url)
29 .pipe(mergeMap(() => Browser.close()))
30 .subscribe();
31 } else {
32 Browser.close();
33 }
34 }
35 });
36 });
37 }
38}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected