I am trying to get a basic Rails, Graphql, Apollo-Client setup working but having trouble with 422 errors \'invalid auth token\' on the rails side.
Does my use of apoll
Using apollo-boost, it's a little different.
import ApolloClient from 'apollo-boost'
const client = new ApolloClient({
fetchOptions: {
credentials: 'same-origin',
},
request: (operation) => {
const csrfToken = document.querySelector('meta[name=csrf-token]').getAttribute('content')
operation.setContext({
headers: { "X-CSRF-Token": csrfToken }
})
},
})