I’m following the auth0 angular spa integration. The code is clear except for this one line.
For reference the full integration code is on this page.
private handleAuthCallback() {
// Call when app reloads after user logs in with Auth0
const params = window.location.search;
if (params.includes('code=') && params.includes('state=')) {
let targetRoute: string; // Path to redirect to after login processsed
const authComplete$ = this.handleRedirectCallback$.pipe(
// Have client, now call method to handle auth callback redirect
tap(cbRes => {
// Get and set target redirect route from callback results
targetRoute = cbRes.appState && cbRes.appState.target ? cbRes.appState.target : '/';
}),
concatMap(() => {
// Redirect callback complete; get user and login status
return combineLatest([
this.getUser$(),
this.isAuthenticated$
]);
})
);
// Subscribe to authentication completion observable
// Response will be an array of user and login status
authComplete$.subscribe(([user, loggedIn]) => {
// Redirect to target route after callback processing
this.router.navigate([targetRoute]);
});
}
}
more specifically this part of the function:
authComplete$.subscribe(([user, loggedIn]) => {
// Redirect to target route after callback processing
this.router.navigate([targetRoute]);
I get the error when I try to compile
ERROR in src/app/authorization/authorization/authorizationservice.ts:122:32 - error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator.
122 authComplete$.subscribe(([user, loggedIn]) => {
Did a little googling and found this page:
Read it about a dozen times and I don’t understand why this code is erroring out.
I was hoping some one could clarify, and if need be has anyone intergrated auth0 with angular in another way?