如何访问 WSO2 API 经理商店 API?
How to access WSO2 API Manager's Store API?
我正在阅读他们 Store API 的 WSO2 APIM 文档。但是我不知道如何通过这个 API.
进行身份验证
根据我从该页面了解到的情况,我需要通过 /token API 获得一个特殊令牌。但是示例显示他们提供了某种身份验证来获取此令牌,但我无法弄清楚它是哪一个。
所以我想我的问题是:
- 如何获取 WSO API 经理的新商店 API 的访问令牌?
获取访问权限的方法如下(Reference)。
1.Register 您的 oauth 应用程序使用动态客户端注册 API
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
}
这里使用基本的auth.You需要在Authrization header中提供base 64编码username:password(eg:admin:admin)
示例响应。
{
"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"
}
2.Use令牌API获取oauth访问令牌
curl -k -d "grant_type=password&username=admin&password=admin&scope=apim:subscribe" -H "Authorization: Basic SGZFbDFqSlBkZzV0YnRyeGhBd3liTjA1UUdvYTpsNmMwYW9MY1dSM2Z3ZXpIaGM3WG9HT2h0NUFh" https://127.0.0.1:8243/toke
这里基本的auth参数是base 64编码的clientId:ClientSecret
现在你有一个访问令牌来调用商店 APIs
我正在阅读他们 Store API 的 WSO2 APIM 文档。但是我不知道如何通过这个 API.
进行身份验证根据我从该页面了解到的情况,我需要通过 /token API 获得一个特殊令牌。但是示例显示他们提供了某种身份验证来获取此令牌,但我无法弄清楚它是哪一个。
所以我想我的问题是: - 如何获取 WSO API 经理的新商店 API 的访问令牌?
获取访问权限的方法如下(Reference)。
1.Register 您的 oauth 应用程序使用动态客户端注册 API
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
}
这里使用基本的auth.You需要在Authrization header中提供base 64编码username:password(eg:admin:admin)
示例响应。
{
"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"
}
2.Use令牌API获取oauth访问令牌
curl -k -d "grant_type=password&username=admin&password=admin&scope=apim:subscribe" -H "Authorization: Basic SGZFbDFqSlBkZzV0YnRyeGhBd3liTjA1UUdvYTpsNmMwYW9MY1dSM2Z3ZXpIaGM3WG9HT2h0NUFh" https://127.0.0.1:8243/toke
这里基本的auth参数是base 64编码的clientId:ClientSecret
现在你有一个访问令牌来调用商店 APIs