i Anfänger bin in Web Api und Autorisierung und Authentifizierung der Umsetzung aber einige Fehler bekommen, wie ich weiter unten erwähnt:unsupported_grant_type in Web Api 2
Ich erhalte diesen Fehler während Token von WebAPI
bekommen{"readyState":4,"responseText":"{\"error\":\"unsupported_grant_type\"}","responseJSON":{"error":"unsupported_grant_type"},"status":400,"statusText":"Bad Request"}
Diese Code ist meine jQuery Anfrage für Token
$(document).ready(function() {
$("#login").click(function() {
debugger;
var details = "{'grant_type':'password', 'username': '" + $("#UserName").val() + "', 'password': '" + $("#Password").val() + "' }";
console.log(details);
$.ajax({
type: "POST",
contentType: "application/x-www-form-urlencoded",
data: details,
url: "http://localhost:59926/token",
success: function (data) { console.log(JSON.stringify(data)); },
error: function (data) { console.log(JSON.stringify(data)); }
});
});
'contentType' sollte' application/json' sein. – Venky