How to access via apollo fetch

15 views
Skip to first unread message

gsd asd

unread,
Dec 22, 2017, 2:07:34 PM12/22/17
to RateBeer API
Hello, I am having an issue hitting the API with apollo fetch. I keep getting  {"message":"Forbidden"} even though I am sending my api key with the fetch. Below is my code. Thank you.



const fetch = createApolloFetch({
});

  fetch({
    method: "POST",
    credentials: "include",
    headers: {
      "content-type": "application/json",
      "accept": "application/json",
      "x-api-key": process.env.RATE_BEER
    },
    body: `{
      beer(id: 934) {
        name
      }
    }
    `,
  }).then(res => {
    console.log(JSON.stringify(res));
    console.log("will this work " + res);
  });

Reply all
Reply to author
Forward
0 new messages