使用wso2 API管理器产品api时出现问题

时间:2019-01-31 15:08:04

标签: wso2 wso2-am

我正在尝试探索产品api以使用curl命令创建api。     我按照文档创建了访问令牌。到那时为止一切正常     但是,当我尝试使用以下命令调用发布者服务时,出现错误

 curl -v  -k -H "Authorization: Bearer <access token obtained>" http://<host ip address>:9763/api/am/store/v0.14/apis 


* About to connect() to <host ip address> port 9763 (#0)
*   Trying <host ip address>...
* Connected to <host ip address> (<host ip address>) port 9763 (#0)
> GET /api/am/store/v0.14/apis HTTP/1.1
> User-Agent: curl/7.29.0
> Host: <host ip address>:9763
> Accept: */*
> Authorization: Bearer <access token obtained>
>
< HTTP/1.1 401 Unauthorized
< Date: Thu, 31 Jan 2019 15:03:08 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
<
* Connection #0 to host <host ip address> left intact
{"code":401,"message":"","description":"Unauthenticated request","moreInfo":"","error":[]} 

I have rechecked my login credentials while generating the client key and then the client and client key while generating the token. I am not sure what is going wrong. Can anyone help

1 个答案:

答案 0 :(得分:0)

确保在生成令牌时提供了相关范围。每个资源都有https://docs.wso2.com/display/AM260/apidocs/publisher/#!/operations#APICollection#apisGet中定义的特定范围。在此范围是apim:api_view。在令牌响应中,检查是否已获得相关范围。