0
Talk, you guys!
Next, I developed an api in spring boot and already tested with Postman and it works normally, its security is a very basic oauth authentication. Now I’m testing in an application in c# I have here to return the token to be able to consume the endpoints, however when I’m making the call to return the token is returning me:
"System.Net.WebException: 'O servidor remoto retornou um erro: (400) Solicitação Incorreta.'"
Follow the code below:
WebRequest req = WebRequest.Create(@"http://localhost:8080/oauth/token");
req.Method = "POST";
req.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes("apisustentacao:HHednf8iwFgre$$$@"));
HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
In Postman this working normally:
Below is more picture of the Postman header:
I appreciate anyone who can help me
Have you developed a Rest API? You could post the other Postman images showing the Headers, Body, Parameters?
– Pedro Paulo
Error 400 indicates that the request reached the server and was processed, but something sent was not correct. Did you try to capture the Webexception Response and verify what it says? Would that be the message you pasted Response?
– Gabriel Coletta
Yes this is the message
– Airton Lira jr
added more print from Postman @Pedropaulo
– Airton Lira jr