How to send Basic Auth? to axios of vue

there are places where post Basic Auth is needed in the project. It is no problem to configure authorization in postman, but it cannot be sent by using axios in the code. An error of 401 is reported, and relevant materials are consulted, but none of them take effect.

the following is a screenshot of chrome error

clipboard.png

related codes

axios({
              method: "post",
              url: "http://172.16.20.12:8003/rpc",
              auth: {
                username: "admin",
                password: "123456"
              }
            }).then(result=>{
              console.log("11111");
            });


Nov.14,2021

do not deal with options in the background


could you tell me the specific code to send basic auth


Hello, have you solved it? have I encountered the same situation? how to solve it

?
Menu