title: React - Send cookie to Express
body: <p>I am getting a token to access an API endpoint and I want to send this token to my server-side app (expressJS) to retreive the data. </p>
  
  <p>I have the following for my react app:</p>
  
  <pre><code>export default class Account extends React.Component {
      constructor() {
          super();
          this.state = {
            token: null,
            response: {
  
            }
          };
          this.getCurrentlyPlaying = this.getCurrentlyPlaying.bind(this);
        }
        componentDidMount() {
          // Set token
          let _token = hash.access_token;
          if (_token) {
            this.setState({
              token: _token
            });
            const cookies = new Cookies();
            cookies.set('token', _token, { path: '/' });
            console.log(cookies.get('token'));
            this.getCurrentlyPlaying(_token);
          }
        }
  
        getCurrentlyPlaying() {
          fetch(`http://localhost:3001/account`)
          .then(res =&gt; res.json())
          .then(data =&gt; {
            this.setState ({
                response: data
            })
            console.log(data);
          });
        }
      render() {
         if (this.state.response[0].is_playing  === true) {
          return (
            &lt;p&gt; Something is playing&lt;/p&gt;
           );
         }
         else {
           return (
            &lt;p&gt; Nothing is playing&lt;/p&gt;
           );
         }
      }
  }
  </code></pre>
  
  <p>In my express app, I have the cookie being gotten but I'm not sure if it actually is getting the cookie created by the react app:</p>
  
  <pre><code>  router.get('/account', (req, res) =&gt; {
      const config = {
        headers: {
          'Authorization': `Bearer ${req.session.token}`
        }
      };
      fetch(`${CONFIG.spotifyUrl}/me/player/currently-playing `, config)
      .then(html =&gt; html.json())
      .then(json =&gt; {
        res.json(json);
      });
    });
  module.exports = router;
  </code></pre>
  
  <p>Can someone tell me where I'm going wrong please? </p>