1

I have an api with the following documentation. I am currently using axios. I am getting an Unauthorized error

const res=axios.get("http://aaaaaaaaa.com", {
                Authorization: {
                    'Username' : '09822222222',
                    'Password' : 'sana1234'
                },
                headers:{
                    'Content-Type': 'application/json'
                }
            });

Header “Content-Type”: “application/json” The login credentials should be passed as basic-auth through Authorization header Username: “test” Password: “test”

  • Does this answer your question? [How to send Basic Auth with axios](https://stackoverflow.com/questions/44072750/how-to-send-basic-auth-with-axios) – ssc-hrep3 Oct 04 '21 at 10:54
  • You also might want to check out CORS, if you are trying to connect to another domain. – ssc-hrep3 Oct 05 '21 at 10:09

0 Answers0