title: token is missing in my vue app
body: <p>I have this response with <a href="https://github.com/jakubroztocil/httpie" rel="nofollow noreferrer">httpie</a> when an user is logged:</p>
  
  <pre><code>chat-api$ http :3000/signup username=tomatito password=123
  HTTP/1.1 201 Created
  Cache-Control: max-age=0, private, must-revalidate
  Content-Type: application/json; charset=utf-8
  ETag: W/"01dfe24bd7415e252b5aee50e12198a3"
  Transfer-Encoding: chunked
  Vary: Origin
  X-Request-Id: a095148b-592a-4347-820f-63e1efa0e409
  X-Runtime: 0.347726
  
  {
      "auth_token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1LCJleHAiOjE1MjEzMTg4NDV9.45JDA7vk-K8gUzCB1xABKMifi-IWGoVESedKykGiqGo", 
      "message": "Account created successfully"
  }
  </code></pre>
  
  <p>The object is persisted in my database.</p>
  
  <p>However when i make this request with axios from my vue.js form I get nothing in <strong>localStorage</strong></p>
  
  <p>this is my <strong>axios.js</strong> code:</p>
  
  <pre><code>import axios from 'axios'
  const API_URL = process.env.API_URL || 'http://localhost:3000/'
  
  export default axios.create({
    baseURL: API_URL,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer ' + localStorage.auth_token
    }
  })
  </code></pre>
  
  <p>the object is persisted in database right but i get <code>Authorization:Bearer undefined</code></p>
  
  <p>these are my headers:
  Response:</p>
  
  <pre><code>Access-Control-Allow-Methods:GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD
  Access-Control-Allow-Origin:http://localhost:8081
  Access-Control-Expose-Headers:
  Access-Control-Max-Age:1728000
  Cache-Control:max-age=0, private, must-revalidate
  Content-Type:application/json; charset=utf-8
  ETag:W/"fdac439f3ada9e343d0815bb49dff277"
  Transfer-Encoding:chunked
  Vary:Origin
  X-Request-Id:9e318050-ceca-480c-a847-d59f9ebb18b7
  X-Runtime:0.447976
  </code></pre>
  
  <p>Request:</p>
  
  <pre><code>Accept:application/json, text/plain, */*
  Accept-Encoding:gzip, deflate, br
  Accept-Language:en-US,en;q=0.9
  Authorization:Bearer undefined
  Connection:keep-alive
  Content-Length:44
  Content-Type:application/json
  Host:localhost:3000
  Origin:http://localhost:8081
  Referer:http://localhost:8081/
  User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.
  </code></pre>
  
  <p>Request payload</p>
  
  <pre><code>{username: "tomatito", password: "123456"}
  password:"123456"username:"tomatito"
  </code></pre>
  
  <p>This is my vue script component:</p>
  
  <pre><code>&lt;script&gt;
  export default {
    name: 'SignUp',
    data () {
      return {
        username: '',
        password: '',
        error: false
      }
    },
    methods: {
      signup () {
        this.$http.post('/signup', { username: this.username, password: this.password })
        .then(request =&gt; this.signupSuccessful(request))
        .catch(() =&gt; this.signupFailed())
      },
      signupSuccessful (req) {
        if (!req.data.token) {
          this.signupFailed()
          return
        }
        localStorage.token = req.data.token
        this.error = false
        this.$router.replace(this.$route.query.redirect || '/rooms')
      },
      signupFailed () {
        this.error = 'Sign up failed!'
        delete localStorage.token
      }
    }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm getting <strong>Sign up failed</strong>, However the object is persisted in database. My back-end is ruby on rails. How can i receive in my <code>data.token</code> in payload?</p>
  
  <p>This is my <strong>main.js</strong> file</p>
  
  <pre><code>import Vue from 'vue'
  import App from './App'
  import router from './router'
  import axios from './backend/vue-axios'
  
  Vue.config.productionTip = false
  
  /* eslint-disable no-new */
  new Vue({
    el: '#app',
    router,
    components: { App },
    axios,
    template: '&lt;App/&gt;'
  })
  </code></pre>
  
  <p>This is my <strong>vue-axios/index.js</strong> file:</p>
  
  <pre><code>import Vue from 'vue'
  import VueAxios from 'vue-axios'
  
  import axios from './axios'
  
  Vue.use(VueAxios, axios)
  </code></pre>
  
  <p><strong>Updated</strong> The problem was in <strong>req</strong>. it's <strong>res</strong> to receive the token instead of <strong>req</strong></p>
  
  <pre><code>signup() {
        this.$http
          .post("/signup", { username: this.username, password: this.password })
          .then(res =&gt; this.signupSuccessful(res))
          .catch(() =&gt; this.signupFailed());
      },
      signupSuccessful(res) {
        if (!res.data.auth_token) {
          this.signupFailed();
          return;
        }
        this.error = false;
        localStorage.token = res.data.auth_token;
        this.$store.dispatch("login");
        this.$router.replace(this.$route.query.redirect || "/rooms");
      },
      .
      .
      .
      .
  </code></pre>
  
  <p>Thank you</p>