Hi, I am trying to figure how headers work in the context of launchpad. In the hello world example is mentions grabbing the context from the request https://launchpad.graphql.com/new
Though Spotify example does not use it: https://launchpad.graphql.com/pjwnq05l0
For more context this is pad I created trying use the Netlify API to wrap GraphQL around an existing REST API. In my header, I have created
const resolvers = {
Query: {
user: (root, args, context) => {
return fetch('https://api.netlify.com/api/v1/user', {
method: "POST",
headers: `Authorization: bearer ${context.headers.access_token}`
})
.then(res => res.json()).catch(err => console.log(err));
},
},
};
I also tried process.env.access_token
instead of context.headers.access_token
.
Is there something I am missing?