简体   繁体   English

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

[英]How to register REST client in WSO2 API Manager

I've been looking through the doc of wso2 apim.我一直在浏览 wso2 apim 的文档。 https://docs.wso2.com/display/AM1100/apidocs/store/index.html#guide https://docs.wso2.com/display/AM1100/apidocs/store/index.html#guide

And found the curl request:并找到了 curl 请求:

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

With payload:带有效载荷:

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

But I got and 403 error response.但是我得到了 403 错误响应。 As expected I should get the correct response payload like:正如预期的那样,我应该得到正确的响应负载,例如:

{
"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"
}

I have not idea what's going on, I just followed the doc above and without any changes.我不知道发生了什么,我只是按照上面的文档进行操作,没有任何更改。 Will be appreciated if anyone can help.如果有人可以提供帮助,我们将不胜感激。 Thanks.谢谢。

Looks like your DCR call is being blocked by some security filter.看起来您的 DCR 呼叫被某个安全过滤器阻止。 May be because you're reaching a wrong endpoint.可能是因为您到达了错误的终点。

I believe you're using APIM 2.0.0.我相信您正在使用 APIM 2.0.0。 If yes, your DCR url should be this.如果是,您的 DCR 网址应该是这个。 (note version v0.10 ) (注意版本v0.10

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

Try and see if this solves your issue.尝试看看这是否能解决您的问题。

Update: Looks like this URL is wrong on 2.0.0 docs .更新:看起来这个 URL 在2.0.0 docs上是错误的。 I'll reach WSO2 Docs team to fix it.我会联系 WSO2 Docs 团队来修复它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM