Authorization HTTP header for yelp fusion api access token


I am currently working on the nightlife coordinator project and using the yelp fusion api. I have the access token but how do I use it.


I used the following code (using request):

  request.get(""+location+"&offset="+offset, {
    auth: {
      "bearer": access_token


How do you do it without request, like with JQuery or Vanilla Javascript


I assumed you would use it with Node. Using the fetch API:

const access_token = "---------";

let myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer " + access_token);

fetch(" York", {
  headers: myHeaders 
}).then((res) => {
  return res.json();
}).then((json) => {

Note that I had to use cors-anywhere to avoid CORS issues.


Thank you so much it has been a problem I have been trying to solve for awhile


Edit: worked a treat. Thanks!