如何在 WSO2 API Manager 中注册 REST 客户端

How to register REST client in WSO2 API Manager

我一直在查看 wso2 apim 的文档。 https://docs.wso2.com/display/AM1100/apidocs/store/index.html#guide

并找到 curl 请求:

curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -d @payload.json http://localhost:9763/client-registration/v0.9/register

有效载荷:

{
"callbackUrl": "www.google.lk",
"clientName": "rest_api_store",
"tokenScope": "Production",
"owner": "admin",
"grantType": "password refresh_token",
"saasApp": true
}

但是我得到了 403 错误响应。 正如预期的那样,我应该得到正确的响应负载,如:

{
"callBackURL": "www.google.lk",
"jsonString":
"{
\"username\":\"admin\",
\"redirect_uris\":\"www.google.lk\",
\"tokenScope\":[Ljava.lang.String;@3a73796a,
\"client_name\":\"admin_rest_api_store\",
\"grant_types\":\"authorization_code password refresh_token iwa:ntlm
urn:ietf:params:oauth:grant-type:saml2-bearer client_credentialsimplicit\"
}",
"clientName": null,
"clientId": "HfEl1jJPdg5tbtrxhAwybN05QGoa",
"clientSecret": "l6c0aoLcWR3fwezHhc7XoGOht5Aa"
}

我不知道发生了什么,我只是按照上面的文档进行操作,没有进行任何更改。 如果有人可以提供帮助,将不胜感激。 谢谢。

您的 DCR 调用似乎被某些安全过滤器阻止了。可能是因为您到达了错误的终点。

我相信您使用的是 APIM 2.0.0。如果是,你的 DCR url 应该是这样的。 (注意版本v0.10

http://localhost:9763/client-registration/v0.10/register

试试看这是否能解决您的问题。

更新:看起来 URL 在 2.0.0 docs 上是错误的。我会联系 WSO2 文档团队来修复它。