Katana Webserver没有找到clientSecret

Pou*_*sen 4 owin katana

我下载了katana项目,想在沙箱项目中尝试客户端/服务器.

我为OAuthValidateClientAuthenticationContext遇到了一个问题:

public bool TryGetFormCredentials(out string clientId, out string clientSecret)
{
    clientId = Parameters.Get(Constants.Parameters.ClientId);
    if (!String.IsNullOrEmpty(clientId))
    {
        clientSecret = Parameters.Get(Constants.Parameters.ClientSecret);
        ClientId = clientId;
        return true;
    }
    clientId = null;
    clientSecret = null;
    return false;
}
Run Code Online (Sandbox Code Playgroud)

clientSecret为null,因此以下内容未验证客户端.

    private Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
    {
        string clientId;
        string clientSecret;
        if (context.TryGetBasicCredentials(out clientId, out clientSecret) ||
            context.TryGetFormCredentials(out clientId, out clientSecret))
        {
            if (clientId == "123456" && clientSecret == "abcdef")
            {
                context.Validated();
            }
            else if (context.ClientId == "7890ab" && clientSecret == "7890ab")
            {
                context.Validated();
            }
        }
        return Task.FromResult(0);

    }
Run Code Online (Sandbox Code Playgroud)

wch*_*ard 5

确保client_secret参数不包含帖子中的空格

client_secret[space] will fail.
Run Code Online (Sandbox Code Playgroud)