How to add custom headers to GraphQL queries?

Ok, this appears to be working, at least using the dev server.

I had to hack together my own version of getUserFromContext in the graphql function, but otherwise it seems to be pretty straightforward.

@peterp I would love for you to take a look at the repo and see if you have any thoughts or suggestions (link below). Specifically, if you can look at the GoogleAuthContext.js file, as well as how I’m storing the user and profile in the User services.

I also tried to get it deployed to Netlify, but the graphql function is throwing an error like "Error: Cannot find module '@babel/runtime-corejs3/helpers/interopRequireWildcard'. Any thoughts on what that’s about?

2 Likes