title: How to make http get request to a drupal 7 website from reactjs application
body: <p>I am building a headless-drupal application using reactjs, My application is basically running on a localhost:3000 while making http requests to the remote drupal 7 website. I have enabled CORS and was able to make a hppt POST request to login, i have the session id, token saved to my browser's local storage but when i try making get requests to the same server using superagent but the response returned is empty</p>
  
  <p>{nodes: Array(0)}nodes: Array(0)length: 0__proto__: Array(0)<strong>proto</strong>: Objectconstructor: ƒ Object()<strong>defineGetter</strong>: ƒ <strong>defineGetter</strong>()<strong>defineSetter</strong>: ƒ <strong>defineSetter</strong>()hasOwnProperty: ƒ hasOwnProperty()<strong>lookupGetter</strong>: ƒ <strong>lookupGetter</strong>()<strong>lookupSetter</strong>: ƒ <strong>lookupSetter</strong>()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toString: ƒ toString()valueOf: ƒ valueOf()toLocaleString: ƒ toLocaleString()get <strong>proto</strong>: ƒ <strong>proto</strong>()set <strong>proto</strong>: ƒ <strong>proto</strong>()</p>
  
  <p>I also made a similar request to the same server but to a different end point and it returned this error:</p>
  
  <p>Access to XMLHttpRequest at '<a href="http://website.com/endppoint-json" rel="nofollow noreferrer">http://website.com/endppoint-json</a>' from origin '<a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
  client.js:890 GET <a href="http://website.com/endppoint-json" rel="nofollow noreferrer">http://website.com/endppoint-json</a> net::ERR_FAILED</p>
  
  <p>this is what my code looks like:</p>
  
  <pre><code>superagent
        .get('http://website.com/endpoint-json')
        .set('Authorization', `Bearer ${this.getAuthenticationToken()}`)
        .end((err, res) =&gt; {
          if(err) {this.setState({errorMessage: 'Cannot retrieve geofences from server'}); return;}
          //this.setState({geofences: res.body});
          console.log(res.body);
        });
  </code></pre>
  
  <p>please what have i not done correctly, this is my first time of making such http request and it is really giving a tough time please help, not insult please.</p>