title: Angular : How to get user id in api authorization
body: <p>I have this following service code block under <code>authorize.service.ts</code> and from that return value, I can fetch the current logged in user's userName:</p>
  
  <pre><code>  public getUser(): Observable&lt;IUser | null&gt; {
      return concat(
        this.userSubject.pipe(take(1), filter(u =&gt; !!u)),
        this.getUserFromStorage().pipe(filter(u =&gt; !!u), tap(u =&gt; this.userSubject.next(u))),
        this.userSubject.asObservable());
    }
  </code></pre>
  
  <p>This is the <code>getUserFromStorage()</code> function:</p>
  
  <pre><code>  private getUserFromStorage(): Observable&lt;IUser&gt; {
      return from(this.ensureUserManagerInitialized())
        .pipe(
          mergeMap(() =&gt; this.userManager.getUser()),
          map(u =&gt; u &amp;&amp; u.profile));
    }
  </code></pre>
  
  <p>I call this service under my login-menu.component.ts file where I get the user name as follows:</p>
  
  <pre><code>  ngOnInit() {
      this.isAuthenticated = this.authorizeService.isAuthenticated();
      this.userName = this.authorizeService.getUser().pipe(map(u =&gt; u &amp;&amp; u.name));
    }
  </code></pre>
  
  <p>What I want is to fetch user id as well just like the way I fetch user name.</p>