title: How to fix Access to XMLHttpRequest at from origin has been blocked by CORS policy in nuxtjs?
body: <p><a href="https://i.stack.imgur.com/QALPf.png" rel="nofollow noreferrer">request payload</a> </p>
  
  <p>iam using nuxt-auth module and using API for get the token , but i got an error about CORS Policy , what should i do ?</p>
  
  <p>i've try another API for login and success . I got error like this </p>
  
  <blockquote>
    <p>Access to XMLHttpRequest at '<a href="http://blablabla.co.id/index.php/api_users/login" rel="nofollow noreferrer">http://blablabla.co.id/index.php/api_users/login</a>' from origin '<a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.</p>
  </blockquote>
  
  <p>this is my nuxt.config.js :</p>
  
  <pre><code>axios: {
   baseURL: 'http://blablabla.co.id/index.php'
  },
  auth: {
   redirect: {
    login: '/login',
    home: '/mainmap',
    logout: '/login'
  },
  strategies: {
    local: {
      endpoints: {
        login: {
          url: '/api_users/login',
          method: 'post',
          propertyName: 'token'
        },
        logout: false
      }
    }
  },
  token: {
    name: 'token'
  },
  cookie: {
    name: 'token'
  }
  </code></pre>
  
  <p>and my login component:</p>
  
  <pre><code>async login () {
      try {
        await this.$auth.loginWith('local', {
          data: {
            username: this.username,
            password: this.password
          }
        })
  
        this.$router.push('/')
      } catch (e) {
        console.log(e.response)
        this.error = e.response.data.error
      }
    }
  </code></pre>
  
  <p>Response from API is </p>
  
  <blockquote>
    <p>{"status_code":400,"status_text":"BAD REQUEST","error":["username field is required","password field is required"]}</p>
  </blockquote>
  
  <p>i've debug and username and password is doesnt empty, so anyone can help with this issue?</p>