Wso2 Api 管理器 - OAuth 令牌错误 - OAuth 应用程序未处于活动状态

Wso2 Api Manager - OAuth Token Error- OAuth application is not in active state

我正在尝试测试此处记录的发布者 apis“RESTful API for WSO2 API Manager - Publisher

要执行任何 api,我需要一个管理员访问令牌。要生成它,建议 运行 以下命令:

curl -k -d "grant_type=password&username=admin&password=admin&scope=apim:api_view" -H "Authorization: Basic SGZFbDFqSlBkZzV0YnRyeGhBd3liTjA1UUdvYTpsNmMwYW9MY1dSM2Z3ZXpIaGM3WG9HT2h0NUFh" https://127.0.0.1:8243/token

我用admin 和admin 用户的密码替换了基本授权。当我尝试执行它时出现以下错误:

{
  "error": "invalid_client",
  "error_description": "Oauth application is not in active state."
}    
Status Code : 401 Unauthorized

有什么不对请指教。谢谢

授权 header 应包含 clientId:secret

的 base64 编码值

你应该先用curl命令获取clientId和secret 1 然后执行[2]

1 curl -X POST -H "Authorization: Basic base64(username:password)" -H "Content-Type: application/json" -d <payload> http://localhost:9763/client-registration/v0.11/register

this 文档中找到示例 json。

[2]curl -k -d "grant_type=password&username=<username>&password=<password>&scope=apim:api_view" -H "Authorization: Basic base64(clientId:secret)" https://127.0.0.1:8243/token

与接受的答案类似,它让我检查了我从另一个应用程序复制的客户端 ID 和密码的编码。

解法:

虽然肉眼看不出区别,I copied the client id and secret directly from ws02 and pasted into postman auth and that fixed it.

即使字符相同,上述解决方案也有效。这让我相信一个或多个字符编码错误,或者我在那里有一个不可见的字符。另一位开发人员也遇到了与 copy/paste.

相同的问题