Closed peterlawless closed 6 years ago
My solution was to provide initialValues
to my sign up form using ReduxForm:
export default reduxForm({
form: 'signUp',
initialValues: { authenticityToken: document.getElementsByName('csrf-token')[0].content}
})(SignUpForm);
There is a related discussion here about how to solve this in Rails - it involves protect_from_forgery with: :null_session
https://github.com/lynndylanhurley/devise_token_auth/issues/398
Upon sending a request to the RegistrationsController to sign up, I get a response with a status 422 Unprocessable Entity on account of an invalid (but more likely missing) authenticity token sent with the POST request. My server and client reside on the same domain, so this is not a cross-origin request. Is there a way to hook a rails-generated authenticity token into redux-token-auth for the authentication endpoints? Conversely, what would I be losing by directing the DeviseTokenAuth::RegistrationsController instance to ignore the presence of an authenticity token?