0
私はidentityServer3サンプルアプリケーションを持っています。IdentityServer3 ResourceOwner角度リクエストから400が返されます。不正リクエスト
public static IEnumerable<Client> GetClients()
{
return new[]
{
new Client
{
Enabled = true,
ClientId = "manager",
ClientName = "ManagerIdentity",
Flow = Flows.ResourceOwner,
ClientSecrets = new List<Secret>
{
new Secret("secret".Sha256())
},
AllowedScopes = new List<string>
{
Constants.StandardScopes.OpenId
},
AllowAccessTokensViaBrowser = true,
AllowedCorsOrigins = new List<string>{
"http://localhost:24678/" // angular application uri
}
}
}
私は郵便配達員とトークンリターンでこの情報を使用しています。
しかし、私はそれが400不正な要求を返すangularjs javascriptのアプリケーションを介して同じ要求を送信します。
angular.module("app").controller("ROPCController", [
"$scope","$http",
function($scope,$http) {
$scope.login = function() {
var options = {
"url": "http://localhost:4751/connect/token",
"method": "POST",
"data": {
"username": "muser",
"password": "password",
"grant_type": "password",
"client_id": "manager",
"client_secret": "secret",
"scope":"openid"
},
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
}
};
$http(options).then(
function(response) {
console.log(response.data);
},
function(error) {
console.log(error);
}
);
}
}
]);
{「エラー」:「invalid_client」}
私は、アプリケーション/ jsonコンテンツタイプが「415サポートされていないメディアタイプ」 – barteloma
を返すようにしました。データフォーマットを「データ」のような文字列に変更しようとしましたか?「username = muser&password = password&grant_type = password&...」 "Content-Type": "application/x-www-form-urlencoded"? – hakany
okしてくれてありがとう。 – barteloma