Keycloak 的请求错误中未提供客户端机密

Client secret not provided in request error with Keycloak

将服务器端客户端的访问类型更改为机密后,我遇到了以下问题。它在 public 类型下运行良好。

这是我的适配器设置:

<subsystem xmlns="urn:jboss:domain:keycloak:1.1">
    <secure-deployment name="appWEB.war">
        <realm>demo</realm>
        <resource>app</resource>
        <public-client>true</public-client>
        <auth-server-url>http://localhost:8180/auth</auth-server-url>
        <ssl-required>EXTERNAL</ssl-required>
        <principal-attribute>preferred_username</principal-attribute>
        <use-resource-role-mappings>true</use-resource-role-mappings>
            <credential name="secret">b35f1121-93a4-4483-a70a-0048b95fd250</credential> 
    </secure-deployment>
</subsystem>

这是登录时在日志中发现的错误:

[Server:node-00] 17:29:06,924 ERROR [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-6) failed to turn code into token [Server:-node-00] 17:29:06,924 ERROR [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-6) status from server: 400 [Server:node-00] 17:29:06,924 ERROR [org.keycloak.adapters.OAuthRequestAuthenticator] {"error":"unauthorized_client","error_description":"Client secret not provided in request"}

有什么想法吗?

错误:

Client secret not provided in request

我猜,你没有在你的应用程序中配置客户端密码,这是机密客户端所必需的。