title: Working with flatmap and tap with Angular 8 and Guard
body: <p>I am trying to create a guard for my routes based on the payload I received in the JWT token. The problem is that I have the first method (authService.getToken()) returning an Observable of NbJWTAuthToken and then I need to query again using the token like in token.getPayload() to then retrieve the payload. </p>
  
  <p>Here is what I tried without much success:</p>
  
  <pre><code>@Injectable()
  export class AdminGuard implements CanActivate {
      constructor(private authService: NbAuthService) { }
  
      canActivate() {
  
          return this.authService.getToken()
             .pipe(
                 flatmap(token =&gt; token.getPayload()),
                 tap((account:Account) =&gt; account.type === AccountType.ADMIN)
             );
      }
  }
  </code></pre>
  
  <p>Any ideas?</p>