title: How to store access token and pass to next api call in javascript fetch
body: <p>I was just wondering if someone could help me figure this out.  My code to get the access token is:</p>
  <pre><code>    const inputBody = 'client_id=00000000-0000-0000-0000-000000000001&amp;secret=mySecretPassword';
      const headers = {
        'Content-Type':'application/x-www-form-urlencoded',
      };
  
      fetch('https://api.replicastudios.com/auth',
      {
        method: 'POST',
        body: inputBody,
        headers: headers
      })
       .then(function(res) {
        return res.json();
      }).then(function(body) {
       console.log(body);
      });
  </code></pre>
  <p>I then need to include the access token received from the first call in order to insert it below.</p>
  <pre><code>    const headers = {
      'Authorization':'Bearer {token}'
      };
  
      fetch('https://api.replicastudios.com/voice',
      {
        method: 'GET',
  
        headers: headers
          })
      .then(function(res) {
         return res.json();
     }).then(function(body) {
        console.log(body);
      });
  </code></pre>
  <p>What is the best way to save the access token and insert it into the second request?</p>