I have to do a POST login request in an API, however I have a problem requesting with the axios.
I set up the request following the documentation of the own axios, using 'auth' in the creation of the 'axios instance', see:
const instance = axios.create({
headers: {
'Content-Type': 'application/json'
},
auth: {
username: 'username', //A senha obviamente não é essa, porém esotu usando as credenciais corretas pois testo no Postman e funciona.
password: 'senha'
}
});
The request:
const request=instance.post('${config.UNIMED_API.development}/wsunimedpj/login', payload);
But the request does not even get done, when I analyze the traffic through the network of the browser is the response:
HTTP Status 401: Full authentication is required to access this resource
What am I forgetting / doing wrong?
Thank you!