Here is my setup
const token = $('meta[name="csrf-token"]').attr('content');
const authLink = setContext((_, { headers }) => {
// return the headers to the context so httpLink can read them
return {
headers: {
...headers,
credentials: 'same-origin',
'X-CSRF-Token': token,
'authenticity_token': token,
}
}
});
I'm trying both X-CSRF-Token
and authenticity_token
and in my GQL request I can see that it's properly being added to the header. I'm grabbing this off of Rail's = csrf_meta_tags
and the value is not null or undefined.
I keep getting a 422 Can't verify CSRF token authenticity.
from the rails server.