title: Angular 2 - What to do when an Http request depends on result of another Http request
body: <p>I'm having trouble figuring out how to use the result of an Http request to make another Http request.</p>
  
  <p>I have a Service that requests and receives JSON Web Tokens from a backend API that looks like:</p>
  
  <pre><code>@Injectable()
  export class JwtAuthorizationService {
  
    constructor(private http: Http) {}
  
    public requestToken(): Observable&lt;string&gt; {
      // Set dummy credentials.
      let body = this.setBody();
      let headers = this.setHeaders();
      let token = this.http.post(tokenUrl, body, { headers: headers })
        .map(this.extractData)
        .catch(this.handleError);
  
      // Return the Observable
      return token;
    }
  
    private extractData(res: Response): string {
      let body = res.text();
      return body || "";
    }
  </code></pre>
  
  <p>How can I now use the result of the <code>requestToken()</code> (an Observable) to make an another API call, authenticated with the JWT, and get the result back from that? Or maybe more simply, what do you do when one Http call depends on the result of another?</p>