Why is there an error when Authorization is added to the post request?

// post
export function post (url, data) {
  let token = "111"                
  return new Promise(function (resolve, reject) {
    axios(url, {
      method: "post",
      headers: {
        "Content-Type": "application/json",
        "Authorization": token  //
      },
      data: JSON.stringify(data)
    }).then(response => {
      resolve(response.data)
    }).catch(error => {
      reject(error)
    })
  })
}

I found that there was an error. Do I need to change something with the cooperation of the back end?

clipboard.png

clipboard.png


Let the backend add Authorization

to Access-Control-Expose-Headers this.

php Code:

  

ask the landlord how to solve this problem. I can't log in by adding Authorization in the same way.

Menu