Identityserver4 IdnetityServer4密码授予javascript 400错误请求

Identityserver4 IdnetityServer4密码授予javascript 400错误请求,identityserver4,Identityserver4,我使用javascript发送请求: var settings = { method: "POST", url: tokenEndPoint.concat("/connect/token"), data: { username: "username", password: "password", grant_typ

我使用javascript发送请求:

        var settings = {
            method: "POST",
            url: tokenEndPoint.concat("/connect/token"),
            data: {
                username: "username",
                password: "password",
                grant_type: "password",
                client_id: "webui",
                client_secret: "32c8e1f3-594d-406a-8e33-644cfa7959c5",
                scope: "openid profile webui"
            },
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        };

        function onGetTokenSuccess(response) {
            return response.data;
        }

        function onGetTokenFailed(error) {
            logger.error('XHR Failed for token request.' + error);
        }

        $http(settings).then(onGetTokenSuccess).catch(onGetTokenFailed);
我的这个javascript请求给出了Http 400错误请求错误。我的日志是这样的:

[12:20:22 Information] IdentityServer4.Hosting.IdentityServerMiddleware
Invoking IdentityServer endpoint: IdentityServer4.Endpoints.TokenEndpoint for /connect/token

[12:20:22 Information] IdentityServer4.Validation.TokenRequestValidator
User authentication failed: Invalid username or password.
但是,使用邮递员时,这些参数可以很好地工作

我的客户端设置如下:

  {
    "Enabled": "true",
    "ClientId": "webui",
    "ClientName": "Web UI",
    "ClientSecrets": [
      {
        "Description": "32c8e1f3-594d-406a-8e33-644cfa7959c5",
        "Expiration": "",
        "Type": "SharedSecret",
        "Value": "Q3ADcd+nptsnMpvXvCMvquwFd8i26ImBsncNGg/UG/w="
      }
    ],
    "UserClaims": [
      "role"
    ],
    "AllowedGrantTypes": [
      "password"
    ],
    "AllowedScopes": [
      "openid",
      "profile",
      "webui"
    ]
  }  

尝试检查在浏览器中发送的数据,因为它清楚地表明无效的用户名或密码。相同的请求参数使用邮递员工作。用户名和密码相同。