我需要针对IBM WebSphere服务器实现OAuth。为此,我根据https://github.com/hhoechtl/websphere-oauth构建了一个docker环境http://www.ibm.com/developerworks/websphere/techjournal/1305_odonnell2/1305_odonnell2.html

但是如果我尝试获得 token

curl -X POST -H "Accept-Charset: UTF-8" -H "Content-Type: application/x-www-form-urlencoded" -d 'grant_type=password&client_id=LibertyRocks&client_secret=AndMakesConfigurationEasy&username=admin&password=admin' "https://192.168.99.100:9443/oauth2/endpoint/DemoProvider/token"

我得到了错误
{
  "error_description": "CWWKS1406E: The token request had an invalid client credential. The request URI was /oauth2/endpoint/DemoProvider/token.",
  "error": "invalid_client"
}

但是根据我的server.xml应该是正确的。我想念什么?

最佳答案

您是否可以打开并提供该调用的服务器跟踪?该消息表明在请求中找不到凭据,或者找到了凭据但对该客户端无效。了解此处的情况将很有用。

您可以通过将以下代码段添加到server.xml中来启用跟踪:

<logging traceSpecification="*=info=enabled:com.ibm.ws.security.*=all=enabled:com.ibm.oauth.*=all=enabled" />

关于oauth - WebSphere Docker OAuth,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37944944/

10-11 07:16