0
votes

I was trying to test publisher apis documented here "RESTful API for WSO2 API Manager - Publisher"

To execute any api i need a admin access toke. To generate that, it is advised to run following command :

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

I replaced basic authorization with admin and password of admin user. I got following error when i attempted to execute it:

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

please advise what is wrong here. Thanks.

1

1 Answers

5
votes

Authorization header should contain the base64 encoded value of clientId:secret

You should first obtain clientId and secret with curl command 1 and then execute [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

A sample json is found in this document.

[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