gpt4 book ai didi

identityserver4 - Identityserver4 连接/ token 端点给出 400 错误请求

转载 作者:行者123 更新时间:2023-12-05 01:27:42 24 4
gpt4 key购买 nike

我们将 EntityFrameworkCore 与 Identity Server4 一起使用。初始设置后,身份服务器的发现端点 (localhost:6000/.well-known/openid-configuration) 工作正常。当我们尝试调用 connect/token来自 postman 的端点它给出了 400 错误的请求响应。这是我们的客户:

public static IEnumerable<Client> GetClients()
{
return new List<Client>
{
new Client
{
ClientId = "client",

// no interactive user, use the clientid/secret for authentication
AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,

// secret for authentication
ClientSecrets =
{
new Secret("secret".Sha256())
},

// scopes that client has access to
AllowedScopes = { ApiResourceName.Sup_Api.Description() }
},
new Client
{
ClientId = "client2",

// no interactive user, use the clientid/secret for authentication
AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,

// secret for authentication
ClientSecrets =
{
new Secret("secret".Sha256())
},

// scopes that client has access to
AllowedScopes = { "sup"}
}
};
}

这是 postman 连接/ token 发布请求:
http://localhost:6000/connect/token
?client_id=client2
&client_secret=secret
&grant_type=client_credentials
&scope=sup

回复:
{
"error": "invalid_request"
}

最佳答案

您不通过查询字符串传递参数。它应该在正文中,使用内容类型 application/x-www-form-urlencoded .
见:https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3

关于identityserver4 - Identityserver4 连接/ token 端点给出 400 错误请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48983059/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com