Answers.Body: <p>Just found the solution:  </p>
  
  <pre><code>npm install qs
  </code></pre>
  
  <p>and</p>
  
  <pre><code>import qs from 'qs'
  
  ...
  const actions = {
      auth({ commit }, { email, password }) {
  
          axios.post('url', qs.stringify({
              your token data here
          })).then((res) =&gt; {
              console.log(res.data)
          }).catch((err) =&gt; {
              console.log(err)
          })
      }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-21T01:20:05.340Z
Answers.Text: This was really helpful but I had to capitalize the Q in `Qs.stringify()` since I wasn't bundling the library with my other js code. If you want a full example of this in action using Vue and Axios, go here: https://craftcms.stackexchange.com/a/30713/4433
Answers.UserDisplayName: Ryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-18T05:28:24.493Z
Answers.LastActivityDate: 2018-05-18T05:28:24.493Z
Answers.UserDisplayName: yu xia
Body: <p>I created a Vue component. And in this component, I use axios to send post request when it's mounted, CSRF token also included, but still got 400 status. Anyone know why?</p>
  
Tags: <ajax><csrf><vue>
Title: Axios post function got 400 bad request
ThreadText: # Axios post function got 400 bad request
  
  (Asked by: username_0 on 2018-05-18)
  
  I created a Vue component. And in this component, I use axios to send post request when it's mounted, CSRF token also included, but still got 400 status. Anyone know why?
  
  **Tags:** ajax, csrf, vue
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-05-18. Score: 3
  
  Just found the solution:
  
  ```
  npm install qs
  
  ```
  
  and
  
  ```
  import qs from 'qs'
  
  ...
  const actions = {
      auth({ commit }, { email, password }) {
  
          axios.post('url', qs.stringify({
              your token data here
          })).then((res) => {
              console.log(res.data)
          }).catch((err) => {
              console.log(err)
          })
      }
  }
  
  ```
  
  > **Comments:**
  > **username_1**: This was really helpful but I had to capitalize the Q in `Qs.stringify()` since I wasn't bundling the library with my other js code. If you want a full example of this in action using Vue and Axios, go here: https://craftcms.stackexchange.com/a/30713/4433  
  
  ---
  
  