Estou tentando autenticar pelo endereço https://instalura-api.herokuapp.com/api/public/login e estou recebendo o erro 405, com a seguinte mensagem: "{"timestamp":1549045493225,"status":405,"error":"Method Not Allowed","exception":"org.springframework.web.HttpRequestMethodNotSupportedException","message":"Request method 'GET' not supported","path":"/api/public/login"}";
Estou fazendo uma requisição POST, conforme código abaixo:
< envia(event){ event.preventDefault();
const requestInfo = {
method:'POST',
body:JSON.stringify({login:this.login.value,senha:this.senha.value}),
headers:new Headers({
'Content-type' : 'application/json'
})
};
fetch('https://instalura-api.herokuapp.com/api/public/login')
.then(response => {
if (response.ok)
{
return response.text();
}
else
{
console.log(response.text());
throw new Error('não foi possível logar.');
}
})
.then(token =>{
localStorage.setItem('auth-token', token);
browserHistory.push('/timeline');
})
.catch(error =>{
this.setState({msg:error.message});
});
}